Subject: [xsl] Grouping "span" with same @class within mixed content element From: Matthieu Ricaud-Dussarget <matthieu.ricaud@xxxxxxxxx> Date: Mon, 20 Dec 2010 15:45:34 +0100 |
<p> text1 <span class="foo">text2</span> text3 <span class="bar">text4</span> <span class="bar">text5</span> <span class="foo>text6</span> <span class="foo">text7</span> <span class="foo">text8</span> <span>text9</span> <span class="foo">text10</span> </p>
<p> text1 <span class="foo">text2</span> text3 <span class="bar">text4 text5</span> <span class="foo>text6 text7 text8</span> <span>text9</span> <span class="foo">text10</span> </p>
<xsl:template match="p" > <xsl:copy> <xsl:for-each-group select="*[@class]" group-adjacent="@class"> <xsl:choose> <xsl:when test="current-grouping-key()"> <span class="{current-group()[1]/@class}"> <xsl:apply-templates select="current-group()/node()" /> </span> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="current-group()/node()" /> </xsl:otherwise> </xsl:choose> </xsl:for-each-group> </xsl:copy> </xsl:template>
<p> <span class="foo">text2</span> <span class="bar">text4 text5</span> <span class="foo>text6 text7 text8</span> <span class="foo">text10</span> </p>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Novice Question - matchin, Wendell Piez | Thread | Re: [xsl] Grouping "span" with same, David Carlisle |
Re: [xsl] Novice Question - matchin, Martin Honnen | Date | RE: [xsl] Novice Question - matchin, David Lee |
Month |