I cannot figure out how to create xsl to group some nodes between other nodes. Basically, every time I see "SPLIT", I have to finish the div and create a new one.
xml looks like this:
<data name="a" />
<data name="b" />
<data name="c" />
<data name="SPLIT" />
<data name="d" />
<data name="e" />
<data name="SPLIT" />
<data name="f" />
<data name="g" />
<data name="h" />
The output should look like this:
<div>
a
b
c
</div>
<div>
d
e
</div>
<div>
f
g
h
</div>
I know how to do this by "cheating", but I would like to know if he has the right way:
<div>
<xsl:for-each select="data">
<xsl:choose>
<xsl:when test="@name='SPLIT'">
<xsl:text disable-output-escaping="yes"> </div> <div></xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@name"/>
</xsl:otherwise>
</xsl:for-each>
</div>
Karen source
share