This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: how to store attribute value?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]