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

Re: Recursion (I think)

Subject: Re: Recursion (I think)
From: Nicholas Orr <nick@xxxxxxxxxxx>
Date: Mon, 26 Sep 2005 22:18:08 +1000
Re:  Recursion (I think)
On 26/09/2005, at 9:52 PM, Ragulf Pickaxe wrote:

Hi,

Would that be

ancestor-or-self::*[ObjectType][1]/@id


No, that you get you an ancestor node (or the current node) that has a childnode with the element name ObjectType.

What purpose does the [1] serve?


What ancester-or-self::*[@id] does, is to select the superset of all ancestors and current node, which have an attribute called id. The [1] here, then, selects the first of these nodes in reverse document order - as that is the order of ancestor-or-self (buttom-up)). The last /@id selects the attribute id of that node.

What you would want was probably something like
ancestor-or-self::*[@id][self::ObjectType][1]/@id

I think you can write:
ancestor-or-self::ObjectType[@id][1]/@id
But this is not tested (I haven't had to do this before, and my
reference book is not nearby).

Hope this helps

Yes, it does, thanks. This whole xslt thing is becoming clearer as I see more examples.


The problem is the examples you see in the books and websites I find never seem to cover the situation I'm working with. And of course, you can never completely describe the problem you're having if you don't know the solution. So thanks michael, david and ragulf for your help. Much appreciated.

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.