Getting all XML Key Value pairs in XSL

May times when I try to design a XSL against an unknown data stream, I would like to know what all values are available. Here is a nifty XSL which I have been using for a while. ( I am sure there are many versions out there ).

<xsl:for-each select="@*">
    <br/> Name: <xsl:value-of select="name()" /> Value:<xsl:value-of select="." />
</xsl:for-each>Â

It gives a list of all elements with their values. Quite handy to check if you have got the element name wrong etc.

Leave a Reply