Pavel Vyazankin
Pavel Vyazankin

Reputation: 1580

XSL show attribute name

So, using that

<xsl:for-each select="./@*">
   [<xsl:value-of/><xsl:value-of select="."/>]
</xsl:for-each>

I can iterate over attribute values. But I want to see attribute names too.

I want see a table: attr1 - val1 attr2 - val2 attr3 - val3 ...

Thanks for help!

Upvotes: 2

Views: 1987

Answers (1)

Dirk Vollmar
Dirk Vollmar

Reputation: 176169

You can do that using name() or local-name():

<xsl:for-each select="./@*">
    [<xsl:value-of select="name()"/><xsl:value-of select="."/>]
</xsl:for-each>

Upvotes: 4

Related Questions