XSL - How to match consecutive comma-separated tags
- by PocketLogic
I'm trying to match a series of xml tags that are comma separated, and to then apply an xslt transformation on the whole group of nodes plus text. For example, given the following partial XML:
<p>Some text here
<xref id="1">1</xref>,
<xref id="2">2</xref>,
<xref id="3">3</xref>.
</p>
I would like to end up with:
<p>Some text here <sup>1,2,3</sup>.</p>
A much messier alternate would also be acceptable at this point:
<p>Some text here <sup>1</sup><sup>,</sup><sup>2</sup><sup>,</sup><sup>3</sup>.</p>
I have the transformation to go from a single xref to a sup:
<xsl:template match="xref"">
<sup><xsl:apply-templates/></sup>
</xsl:template>
But I'm at a loss as to how to match a group of nodes separated by commas.
Thanks.