Re: [xsl] How to get page range within a group

Subject: Re: [xsl] How to get page range within a group
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 12 Sep 2008 17:11:33 -0400
At 11:10 AM 9/12/2008, David wrote:

> (//para)[1]
>
> and
>
> /descendant::para[1]
>
> are equivalent?

yes,

although of course the real expansion is

(/descendant-or-self::node()/child::para)[1]

but it comes to the same thing in this case.

Yes. Their semantics are different, but they return the same node, which I guess makes them equivalent.


The difference between //para[1] and (//para)[1] is that in the former case, the predicate operates only on the final step of a path with two steps, whereas in the latter, the predicate operates on the node set returned by the expression as a whole. This is much easier to see in the long form:

//para[1] is /descendant-or-self::node()/child::para[1]

(//para)[1] is (/descendant-or-self::node()/child::para)[1]

Cheers,
Wendell



======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================

Current Thread