Identity transform

Identity transform

In metadata, the identity transform is an example of a data transformation that copies the source data into the destination data without change.

Establishing an understanding the identity transformation is considered an essential process in creating a reusable Transformation library. By creating a library of variations of the base identity transformation, a variety of data transformation filters can be easily maintained. These filters can be chained together in a format similar to UNIX shell pipes.

Example using XSLT

The most frequently cited example of the identity transform is the "copy.xsl" transform as expressed in XSLT. This transformation uses the xsl copy command to perform the identity transformation:

This template works by first matching all attributes (@*) and then all nodes (node()) and then applying the copy transformation to all sub-nodes of the current data element. This recursively descends the data element hierarchy and outputs all structures in the same structure they were found in the original file.

Example Using XQuery

XQuery allows you to define recursive functions. The following example function copies the input directly to the output without modification.

declare function local:copy($element as element()) { element {node-name($element)} {$element/@*, for $child in $element/node() return if ($child instance of element()) then local:copy($child) else $child ;

Remove Named Element Transform Using XSLT

The identity transformation can be modified to copy everything from an input tree to an output tree except a given node. For example the following will copy everything from the input to the output except the social security number:

Remove Named Element Using XQuery

declare function local:copy-filter-elements($element as element() , $element-name as xs:string*) as element() { element {node-name($element) } { $element/@*, for $child in $element/node() [not(name(.)=$element-name)] return if ($child instance of element()) then local:copy-filter-elements($child,$element-name) else $child } };

To call this you would add the following:

$filtered-output := local:copy-filter-elements($input, 'PersonSSNID')

ee also

* XSLT
* data transformation
* data mapping
* XML pipeline

References

* The original reference to the copy transform in the w3c recommendation document [http://www.w3.org/TR/xslt#copying]
* The identity operation is also a required component of an XML Pipeline using the w3c XProc working draft [http://www.w3.org/TR/xproc/#c.identity] (accessed Nov 21, 2006)
* Use of the identity transform is covered in the book "XSLT Cookbook", O'Reilly Media, Inc., December 1, 2002, by Sal Mangano, ISBN 0-596-00372-2
* Priscilla Walmsley, "XQuery", O'Reilly Media, Inc., Chapter 8 Functions - Recursive Functions - page 109


Wikimedia Foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Look at other dictionaries:

  • Identity Metasystem — The Identity Metasystem is an interoperable architecture for digital identity that enables people to have and employ a collection of digital identities based on multiple underlying technologies, implementations, and providers. Using this approach …   Wikipedia

  • Identity documents in the United States — There is no true national identity card in the United States of America, in the sense that there is no federal agency with nationwide jurisdiction that directly issues such cards to all American citizens. All legislative attempts to create one… …   Wikipedia

  • Discrete Fourier transform — Fourier transforms Continuous Fourier transform Fourier series Discrete Fourier transform Discrete time Fourier transform Related transforms In mathematics, the discrete Fourier transform (DFT) is a specific kind of discrete transform, used in… …   Wikipedia

  • Laplace transform — In mathematics, the Laplace transform is one of the best known and most widely used integral transforms. It is commonly used to produce an easily soluble algebraic equation from an ordinary differential equation. It has many important… …   Wikipedia

  • Weierstrass transform — In mathematics, the Weierstrass transform [Ahmed I. Zayed, Handbook of Function and Generalized Function Transformations , Chapter 18. CRC Press, 1996.] of a function f : R rarr; R is the function F defined by:F(x)=frac{1}{sqrt{4piint {… …   Wikipedia

  • Fast Fourier transform — A fast Fourier transform (FFT) is an efficient algorithm to compute the discrete Fourier transform (DFT) and its inverse. There are many distinct FFT algorithms involving a wide range of mathematics, from simple complex number arithmetic to group …   Wikipedia

  • Hartley transform — In mathematics, the Hartley transform is an integral transform closely related to the Fourier transform, but which transforms real valued functions to real valued functions. It was proposed as an alternative to the Fourier transform by R. V. L.… …   Wikipedia

  • Sumudu transform — In mathematics, the Sumudu transform, is an integral transform similar to the Laplace transform, introduced in the early 1990s by Gamage K. Watugala to solve differential equations and control engineering problems.Formal DefinitionThe Sumudu… …   Wikipedia

  • Binomial transform — In combinatorial mathematics the binomial transform is a sequence transformation (ie, a transform of a sequence) that computes its forward differences. It is closely related to the Euler transform, which is the result of applying the binomial… …   Wikipedia

  • Hadamard transform — The Hadamard transform (also known as the Walsh Hadamard transform, Hadamard Rademacher Walsh transform, Walsh transform, or Walsh Fourier transform) is an example of a generalized class of Fourier transforms. It is named for the French… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”