Skip to content

Instantly share code, notes, and snippets.

@emchateau
Last active August 29, 2015 14:01
Show Gist options
  • Save emchateau/0f3df912697d5fdf74e1 to your computer and use it in GitHub Desktop.
Save emchateau/0f3df912697d5fdf74e1 to your computer and use it in GitHub Desktop.
Split content as attribute values
<!-- Split content as attribute value -->
<xsl:template match="element[@id]">
<xsl:variable name="att-values" select="tokenize(@id, ', ')"/>
<xsl:for-each select="tokenize(., '; ')">
<xsl:variable name="pos" select="position()"/>
<xsl:if test="position() gt 1"><xsl:text>; </xsl:text></xsl:if>
<a href="#{$att-values[$pos]}">
<xsl:value-of select="."/>
</a>
</xsl:for-each>
</xsl:template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment