Getting the value of an attribute in XML

XmlXsltXpathAttributes

Xml Problem Overview


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

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

Xml Solutions


Solution 1 - Xml

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

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSmernView Question on Stackoverflow
Solution 1 - XmlJames SulakView Answer on Stackoverflow