Skip to content

Instantly share code, notes, and snippets.

@MattiSG
Created July 7, 2017 15:14
Show Gist options
  • Save MattiSG/8df5f5044faf0cb6133b109f8f8ef731 to your computer and use it in GitHub Desktop.
Save MattiSG/8df5f5044faf0cb6133b109f8f8ef731 to your computer and use it in GitHub Desktop.
List XML attributes values
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="*">
<xsl:for-each select="@format">
<xsl:text>format: </xsl:text>
<xsl:value-of select="."/>
<xsl:text>
</xsl:text>
</xsl:for-each>
<xsl:for-each select="@type">
<xsl:text>type: </xsl:text>
<xsl:value-of select="."/>
<xsl:text>
</xsl:text>
</xsl:for-each>
<xsl:apply-templates select="*"/>
</xsl:template>
<xsl:template match="/">
<xsl:apply-templates select="*"/>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment