Jimenez, Luis wrote:
Hi All,
as a node can be copied to another location within the XML?
* Processor XSLT 1.0
My XML file:
<root>
<customer>
<personal>
<name>Luis</name>
<phone>1234567</phone>
<age>45</age>
</personal>
<occupation>
<position>engineer</position>
<time>5 years</years>
</occupation>
</customer>
</root>
Desired output: The node <position> is copied into customer/personal
<root>
<customer>
<personal>
<name>Luis</name>
<phone>1234567</phone>
<age>45</age>
<position>engineer</position>
</personal>
<occupation>
<position>engineer</position>
<time>5 years</years>
</occupation>
</customer>
</root>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="personal">
<xsl:copy>
<xsl:apply-templates select="@* | node() | ../occupation/position"/>
</xsl:copy>
</xsl:template>
--
Martin Honnen
http://msmvps.com/blogs/martin_honnen/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--