Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I do this in xslt?

Status
Not open for further replies.

newtoxml

Programmer
Oct 31, 2003
1
US

I have an xml file looks like this:

<root>
<L1>a</L1>
<L2>b
<L3>c</L3>
</L2>
</root>

In my xslt file, I do a template match to get to <L3>

<xsl:template match=&quot;L2/L3&quot;>
need to use the value of L1.
</xsl:template>

Assuming that I get to the node of L3. Now, my question is, how do I get the value of L1 inside of the that match template? Is there a global variable or something in xslt so I can store the L1's value in that global variable and use it in the match template?

Can anyone tell me how I can do this in xslt? Please give me some details because I am still learning this stuff :)

Thanks in advance.





 
<xsl:template match=&quot;L2/L3&quot;>
<xsl:value-of select=&quot;../../L1&quot;/>
</xsl:template>

another way to get to the value would be &quot;/root/L1&quot;.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top