[Home] [By Thread] [By Date] [Recent Entries]
You could try the following stylesheet:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes" /> <xsl:template match="/root"> <root> <xsl:apply-templates select="a" /> </root> </xsl:template> <xsl:template match="a">
<xsl:if test="node()[1][not(self::b)]">
<a>
<xsl:apply-templates select="node()[1]" />
</a>
</xsl:if>
<xsl:copy-of select="b" />
<xsl:if test="b[following-sibling::node()]">
<a>
<xsl:copy-of select="b/following-sibling::node()" />
</a>
</xsl:if>
</xsl:template><xsl:template match="node()"> <xsl:copy-of select="." /> <xsl:apply-templates select="following-sibling::node()[1][not(self::b)]" /> </xsl:template> </xsl:stylesheet> Though I have tested it with Saxon 8.8J, it doesn't use any XSLT 2.0 specific syntax. It would work with a XSLT 1.0 processor as well. This stylesheet uses the sibling recursion technique for positional grouping. This was I think suggested by Michael Kay on the xsl-list. On 9/29/06, alex v. <alex.vett@xxxxxxxxx> wrote: The 'a' and 'b' are complex type, for example: -- Regards, Mukul Gandhi
|

Cart



