xsl-list
[Top] [All Lists]

Re: [xsl] xpath numbering question

2008-09-15 14:43:16
Oh my, so that's what // really means. 
:-) 
Very helpful. Thanks. My problem is solved.


--- On Mon, 9/15/08, Andrew Welch 
<andrew(_dot_)j(_dot_)welch(_at_)gmail(_dot_)com> wrote:

From: Andrew Welch <andrew(_dot_)j(_dot_)welch(_at_)gmail(_dot_)com>
Subject: Re: [xsl] xpath numbering question
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Date: Monday, September 15, 2008, 11:22 AM
I feat I am wracking my brains again on something
simple.

If my xml looks like this:

<A>
 <B1>
   <C1>
   <C2>
   <C3>
 <B2>
   <C4>
   <C5>
   <C6>
 <B3>
   <C7>
   <C8>
   <C9>
</A>

I am trying to access C nodes by position relative to
root using xpath.

For example, to get C9, this does not work: //C[
position()=9 ]  //C[ 9 ]
presumably because the context to begin counting C
nodes is the B node, and there are ony a maximum of 3 C
nodes in that context.

Use:

/descendant::C[9]

or

(//C)[9]

read here for Wendell's and David's explanations to
me the other day:

http://xsl.markmail.org/search/?q=%2Fdescendant#query:%2Fdescendant%20from%3A%22Andrew%20Welch%22%20order%3Adate-backward+page:1+mid:aiml76qzac2kzzzn+state:results



-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


      

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>