Subject: Re: [xsl] [XSL 1.0] Copy node into of other From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Sat, 06 Nov 2010 15:30:29 +0100 |
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/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] [XSL 1.0] Copy node into of o, Jimenez, Luis | Thread | RE: [xsl] [XSL 1.0] Copy node into , Jimenez, Luis |
[xsl] [XSL 1.0] Copy node into of o, Jimenez, Luis | Date | [xsl] Copy a binary file using Java, Geurt Lagemaat |
Month |