[Home] [By Thread] [By Date] [Recent Entries]
On 12/20/06, Fredrik Geers <fredrik@xxxxxxxxxx> wrote:
I have the following xml:
<xsl:template match="node()"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates select="node()[1]"/> </xsl:copy> <xsl:apply-templates select="following-sibling::*[1]"/> </xsl:template> <xsl:template match="a[text()]"> <al> <xsl:apply-templates select="." mode="fill"/> </al> <xsl:apply-templates select="following-sibling::*[not(self::a[text()])][1]"/> </xsl:template> <xsl:template match="a[text()]" mode="fill"> <xsl:copy-of select="."/> <xsl:apply-templates select="following-sibling::*[1][self::a[text()]]" mode="fill"/> </xsl:template> </xsl:stylesheet> The output generated is: <book> <header>title</header> <al> <a>text</a> <a>text</a> </al> <otherelement>title</otherelement> <al> <a>text</a> <a>text</a> </al> <a/> <al> <a>text</a> </al> </book> Notice the <a/> which wasnt present in your example - easy to suppress if that really is the case. By the way, Saxon 8.8 is available now. cheers andrew
|

Cart



