functx:copy-attributes
Copies attributes from one element to another
Description
The functx:copy-attributes function copies attributes from the element in $copyFrom to the element in $copyTo. It leaves all the original attributes and content of $copyTo, except that if $copyTo already has an attribute with the same name of one of $copyFrom’s attributes, its value is updated to match $copyFrom.
Parameters |
Description |
---|---|
copyTo:element() |
the element to copy attributes to |
copyFrom:element() |
the element to copy attributes from |
Examples
XPath |
Results |
---|---|
functx:copy-attributes($in-xml/a, $in-xml/b) |
<a x=”1” y=”2”>123</a> |
functx:copy-attributes($in-xml/b, $in-xml/c) |
<b x=”9” y=”2”>456</b> |
functx:copy-attributes($in-xml/d, $in-xml/c) |
<d z=”5” x=”9”>123</d> |