Smern
Smern

Reputation: 19066

Getting the value of an attribute in XML

How would one get the value of attribute1 (blah) in the following xml using xslt:

<name attribute1="blah" attribute2="blahblah">
</name>

Upvotes: 173

Views: 250489

Answers (1)

James Sulak
James Sulak

Reputation: 32447

This is more of an xpath question, but like this, assuming the context is the parent element:

<xsl:value-of select="name/@attribute1" />

Upvotes: 309

Related Questions