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

Re: <xsl:number> in XPath

Subject: Re: <xsl:number> in XPath
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 9 Dec 2004 16:50:08 GMT
xsl number xpath
(your message came out one word per line, I had to reflow it to read it)


Just a comment on,


> To my understanding i canot use
> the axis in the select xpath because they rely on a context node, wich
> i don't have at the time.  

There is always a current node in XSLT, you can always use an axis in a
select expression.  so I don't understand this comment.

However

> I want to process all <xxx> nodes that
> are at the 1st level of deepness, plus the <xxx> at absolute position
> number n 

> So i translate this to
> 
> <xsl:apply-templates
> select="/menus/menu | (//menu)[$pos]" />

That does seem to be a direct translation of your English into Xpath, so
presumably this is what you want.

But this looks a bit strange:

> <xsl:for-each
> select="ancestor::menu/menu | self::menu | menu">

Given that you already slected all your top level menus and the $pos'th
menu in your first <xsl:apply-templates select="/menus/menu | (//menu)[$pos]" />
why do you need to start walking back up the tree here. That select
selects all ancestor menus that have a parent menu (but not ancestor
menus that don't have a parent menu), the current node and any menu
children of the current node.

If thats what you want, this is the right thing, but it looks strange to
me.


> The
> XML:
> http://gti.clientes.gtinformatica.pt/Site/Java/Menus.xml

sorry, as a matter of policy never check off-list examples (I waste
enough time just looking at small inlined examples on the list:-)

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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.