<root>
<paragraph>
<row id="1">
<childNode>
<grandchildNode>
....
</grandchildNOde>
</childNOde>
</row>
<row id="2">
<childNode>
<grandchildNode>
</grandchildNOde>
</childNOde>
</row>
<specialRow>
<row id="3">
<childNode>
<grandchildNode>
</grandchildNOde>
</childNOde>
</row>
</specialRow>
<row id="4">
<childNode>
<grandchildNode>
.....
</grandchildNOde>
</childNOde>
</row>
</paragraph>
</root>
I want to get rid off <specialRow> element and move all its child
nodes into its place.
Here is what the result tree should like:
<root>
<paragraph>
<row id="1">
<childNode>
<grandchildNode>
.....
</grandchildNOde>
</childNOde>
</row>
<row id="2">
<childNode>
<grandchildNode>
</grandchildNOde>
</childNOde>
</row>
<row id="3">
<childNode>
<grandchildNode>
</grandchildNOde>
</childNOde>
</row>
<row id="4">
<childNode>
<grandchildNode>
</grandchildNOde>
</childNOde>
</row>
</paragraph>
</root>
Thanks in advance
Michael
> I want to get rid off <specialRow> element and move all its child
> nodes into its place.
That is easy if you start with the identity transformation template and
add a template for specialRow that simply processes its child nodes:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="specialRow">
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
If you want to correct the indentation then adding
<xsl:strip-space elements="*"/>
<xsl:output method="xml" indent="yes"/>
should help.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Thank you very much Martin.
Michael