Skip to content

Instantly share code, notes, and snippets.

@xpathr
Created May 10, 2012 14:40
Show Gist options
  • Select an option

  • Save xpathr/2653503 to your computer and use it in GitHub Desktop.

Select an option

Save xpathr/2653503 to your computer and use it in GitHub Desktop.
Implode by buzzomatic
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="implode">
<xsl:param name="items" />
<xsl:param name="separator" select="', '" />
<xsl:for-each select="$items">
<xsl:if test="position() &gt; 1">
<xsl:value-of select="$separator" />
</xsl:if>
<xsl:value-of select="." />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment