[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: how to store attribute value?

Subject: Re: how to store attribute value?
From: Oleg Tkachenko <olegt@xxxxxxxxxxxxx>
Date: Tue, 06 Aug 2002 14:30:17 +0200
storing a value in html
Vinoth Palaniappan wrote:

I have a xml document as:
	<myroot  root_attribute="test_val">
		<a1/>
		<a1/>
	</myroot>
While processing the node "a1" using XSL, i need to access the value of
attribute "root_attribute" of it's parent.

That's very simple and straightforward - just say that you want value of attribite of parent element:


<xsl:template match="a1">
	<xsl:value-of select="../@root_attribute"/>
	<!-- Or the same in nonsimplified syntax -->
	<xsl:value-of select="parent::*/attribute::root_attribute"/>		
</xsl:template>

How can i access the attribute of some node in the template match of another
node?
That's what XPath expresions are for.

--
Oleg Tkachenko
Multiconn International, Israel


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.