I have an XML document that contains the following extract example:
<p>
Some text <GlossaryTermRef href="123">term 1</GlossaryTermRef><GlossaryTermRef href="345">term 2</GlossaryTermRef>.
</p>
I use XSLT to convert this to XHTML using the following template:
<xsl:template match="GlossaryTermRef">
<a href="#{@href}" class="glossary">
<xsl:apply-templates select="node()|text()"/>
</a>
</xsl:template>
This works pretty well, however do I need to insert a space between the two elements GlossaryTermRefif they appear next to each other?
Is there a way to determine if there is a space or text between the current node and the next-sibling? I canβt always insert a space GlossaryTermRef, as it can be followed by a punctuation mark.
source
share