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

Re: Checking a parent's attribute

Subject: Re: Checking a parent's attribute
From: Nicholas Orr <nick@xxxxxxxxxxx>
Date: Wed, 7 Feb 2007 20:03:59 +1100
Re:  Checking a parent's attribute
On 07/02/2007, at 4:07 PM, G. Ken Holman wrote:

<xsl:for-each select="ExportEntries">
        <xsl:if test="../Restore/@state = 'True'">
                <xsl:for-each select="ExportEntry/Field">

This works as I want, but to me it doesn't seem to be the best way.
Is there a better way to do that kind of check?  I want to restrict
it to the "ExportEntries" node first, as there are only a limited
number of times that that node will exist, and the "Restore state"
node is often there for other things, so I think I'm being more
efficient doing it this way.  Am I doing this right?

You use a predicate to achieve this:


  <xsl:for-each select="ExportEntries[../Restore/@state='True']/
                        ExportEntry/Field">
    ...
  </xsl:for-each>

I hope this helps.

That was exactly what I was after, I didn't realise I could do that. Thanks for your help Ken.


Cheers,
Nick

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.