![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - XSLT: Moving node in document [Thread Next] Re: XSLT: Moving node in documentTo: NULL Date: 4/1/2005 10:19:00 AM Claudio Jolowicz wrote:
> Suppose you have this document:
>
> <root>
> <node id="1">
> <node id="4"/>
> <node id="5"/>
> </node>
> <node id="2"/>
> <node id="3"/>
> </root>
> [...]
Not yet tested, but ...
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- put "id=5" into "id=2" -->
<xsl:template match="*[@id='2']">
<xsl:copy>
<xsl:apply-templates select="*[@id='5']"/>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<!-- match "id=5" and do NOTHING -->
<xsl:template match="*[@id='5']"/>
<!-- copy all other stuff -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
--
Volkm@r
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
