[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: [XSL 1.0] Copy node into of other
Subject: Re: [XSL 1.0] Copy node into of other
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Sat, 06 Nov 2010 15:30:29 +0100
|
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/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
|
Atom 0.3 |
|
|