175

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

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

1 Answer 1

310

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

<xsl:value-of select="name/@attribute1" />
Sign up to request clarification or add additional context in comments.

4 Comments

What if the context is not in the parent element?
again, this would be an xpath question ;
@Arty - I think what you're looking for is simply xsl:value-of select="./@attributename"
Can't it be simply @attribute1?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.