Getting the value of an attribute in XML

Dallas picture Dallas · Mar 30, 2011 · Viewed 205.5k times · Source

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

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

Answer

James Sulak picture James Sulak · Mar 30, 2011

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

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