- Identity transform
In
metadata , the identity transform is an example of adata 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 ofdata transformation filter s can be easily maintained. These filters can be chained together in a format similar toUNIX 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.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
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.