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

Re: attribute

Subject: Re: attribute
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 14 Sep 2000 18:32:43 +0100
xslt axis attr
Hi,

><xsl:template match="temp">
><xsl:for-each select="item">
>...
></xsl:for-each>
></xsl:template>
>
>How can I reference an attribute of temp from within the for-each?
>I am saving the attribute to a variable outside of the for-each, is there a 
>better way?

Your XSLT above shows that 'item' is a child of 'temp', and your tree looks
like:

- temp
  +- @attr <-- the attribute you want
  +- item  <-- the current node within the xsl:for-each

Given this, you can see that to get from the 'item' element to the 'attr'
attribute, you need to go up to the 'temp' element (parent:: axis), and
then down again (attribute:: axis) to the 'attr' attribute:

  parent::temp/attribute::attr

Or, shorter:

  ../@attr

If the 'item' element hadn't been related as closely to the 'temp' element,
then setting the variable would have been the only way to do it.

I hope this helps,

Jeni

Jeni Tennison
http://www.jenitennison.com/


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


Current Thread
  • attribute
    • xsl list - Thu, 14 Sep 2000 11:39:47 EDT
      • Jeni Tennison - Thu, 14 Sep 2000 18:32:43 +0100 <=

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.