Re: [XPath] Simplified grouping in primary expressions

On Sunday 08 February 2004 08:28, Bjoern Hoehrmann wrote:
>
>   I suggest to extend Primary expressions in XPath 2.0 to allow a subset
> of the an+b expression as defined in
>
>   http://www.w3.org/TR/css3-selectors/#nth-child-pseudo
>
> for simplified grouping. It is basically possible to express the same
> functionality using count(...), the following-/preceding-sibling axes
> and the mod operator but this is typically rather unconvenient and hard
> to understand for beginners.

You can select the even 'a' children with

  a[(position() mod 2) = 0]

and that's easily generalizable for an+b. Doesn't look that difficult to me.

-- Jan Hidders

Received on Sunday, 8 February 2004 05:13:09 UTC