Subject: RE: Grouping simple flat structure
From: "Ian Proudfoot" <ian.proudfoot@xxxxxxxxxxx>
Date: Mon, 17 Mar 2008 14:58:05 -0000
|
Thank you Andrew. I was not aware of the sibling recursion template.
As I was already using the basic identity transform template, I replaced it
with the modified version, but now some elements are not being copied to the
output. Should it be possible to swap these two templates without re-working
other templates?
Ian
You can use the "sibling-recursion" template (also known as the
"modified identity tempate") which walks the sibling axis one node at
time:
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates select="node()[1]"/>
</xsl:copy>
<xsl:apply-templates select="following-sibling::node()[1]"/>
</xsl:template>
|