[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: Locate specific occurrence of element using XPath


Subject: Re: Locate specific occurrence of element using XPath
From: zun@xxxxxxxxxxxxxx
Date: Sun, 19 Sep 1999 10:32:39 -0400 (EWT)

Hi Takuki, everyone,

On Sun, 19 Sep 1999, Takuki Kamiya wrote:

> I have been having a hard time in trying to figure out if it is at all
> possible to tell XSLT to locate 4th <E> element which comes right beneath
> <A>/<C> in the example below using a single XPath expression. Any help or
> hint will be appreciated.
> 
> <A>
>   <B>
>     <E></E>
>     <E></E>
>     ...
>   <C>
>     <E></E>
>     <E></E>
>   </C>
>   <C>
>     <E></E>
>     <E></E>  <- I am trying to locate this element
>     <E></E>
>     <E></E>
>   </C>
>   <D>
>     <E></E>
>     <E></E>
>     ...
>   </D>
> </A>
> 
> I tried "A/C/E[4]", but apparently it does not work...
> (I learnt why "A/C/E[4]" would not work by reading the spec.)

You want (A/C/E)[4], which is the collection of all E nodes under C, and
then the fourth one.

. . . Sean.



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



Current Thread
Keywords