xsl:template - access attribute from one level up

D

daz_oldham

If I have the following XML:

<xml>
<levelone>
<leveltwo attribute="value">
<levelthree attribute2="value2">
Some Value
</levelthree>
</leveltwo>
</levelone>
</xml>

And the following XSL:

<xsl:template match="ns1:levelthree">
.....
</xsl:template>

How would I refer to the the value of '@attribute' from leveltwo?

I have tried a couple of different ways, but without a lot of luck!

Many thanks

Darren
 
M

Martin Honnen

daz_oldham wrote:

<xml>
<levelone>
<leveltwo attribute="value">
<levelthree attribute2="value2">
Some Value
</levelthree>
</leveltwo>
</levelone>
</xml>

And the following XSL:

<xsl:template match="ns1:levelthree">
.....
</xsl:template>

How would I refer to the the value of '@attribute' from leveltwo?

../@attribute
 
D

daz_oldham

Thanks Martin - I missed out the fact that I am in fact going up two
levels and not one.

You don't have to call me an idiot, I already know ;)

Many thanks

Darren
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,002
Messages
2,570,258
Members
46,857
Latest member
ArleenWill

Latest Threads

Top