Subject: RE: [xsl] creating container elements From: <Jarno.Elovirta@xxxxxxxxx> Date: Tue, 6 Apr 2004 15:29:30 +0300 |
Hi, > Given an input document containing amongst other things a > recurring element I > would like to create a container element in the output > document. To my mind > this was a case of output an opening container tag prior to the first > occurrent of the recurrent element and a closing tag after the last > occurrence. See <http://jenitennison.com/xslt/grouping/>. You want something like <xsl:template match="bar[not(preceding-sibling::*[1][self::bar])]"> <container> <xsl:apply-templates select="." mode="walk"/> </container> </xsl:template> <xsl:template match="bar" /> <xsl:template match="bar" mode="walk"> <foobar> <xsl:copy-of select="@id"/> <xsl:apply-templates/> </foobar> <xsl:apply-templates select="following-sibling::*[1][self::bar]" mode="walk"/> </xsl:template> For bar in mixed content you need to tweak the expressions and patterns. Cheers, Jarno
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] creating container elemen, Michael Kay | Thread | RE: [xsl] creating container elemen, Andrew Welch |
[xsl] creating container elements, Rob Exley | Date | RE: [xsl] creating container elemen, Andrew Welch |
Month |