[Home] [By Thread] [By Date] [Recent Entries]
a kusa wrote:
Source XML: The following stylesheet creates the output you describe from the input you posted: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output indent="yes"/> <xsl:strip-space elements="*"/> <xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template> <xsl:template match="st1/desc | st1/level2">
<xsl:apply-templates/>
</xsl:template> <xsl:template match="level1">
<step1>
<xsl:apply-templates select="st1/*"/>
</step1>
</xsl:template> <xsl:template match="level2/item">
<step2>
<xsl:apply-templates/>
</step2>
</xsl:template> <xsl:template match="level2/item[last()]" priority="3">
<step2>
<xsl:apply-templates/>
<xsl:copy-of select="../following-sibling::spec"/>
</step2>
</xsl:template><xsl:template match="st1/spec"/> </xsl:stylesheet> -- Martin Honnen http://msmvps.com/blogs/martin_honnen/
|

Cart



