This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: how to store attribute value?
- From: Oleg Tkachenko <olegt at multiconn dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Tue, 06 Aug 2002 14:30:17 +0200
- Subject: Re: [xsl] how to store attribute value?
- Organization: Multiconn International Ltd
- References: <C1590740235CD211BA5600A0C9E1F6FF049C8EFA@hydmail>
- Reply-to: xsl-list at lists dot mulberrytech dot com
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