- From: James Clark <jjc@jclark.com>
- Date: Thu, 02 Dec 1999 13:53:13 +0700
- To: xsl-list@mulberrytech.com
- CC: www-xpath-comments@w3.org
preceding::foo[1] parses as a Step not a FilterExpr. Thus 2.1 and 2.4 apply and the axis applicable to the predicate '[1]' is "preceding". (preceding::foo)[1] parses as a FilterExpr and not a Step. Thus 3.3 applies and the axis applicable to the predicate '[1]' is "child". "Paul W. Abrahams" wrote: > > The XPath spec, Sec. 3.3.(Node-sets) contains this note: > > The meaning of a Predicate depends crucially on which axis applies. > For example, preceding::foo[1] returns the first foo element in > reverse document order, because the axis that applies to the [1] > predicate is the preceding axis; > by contrast, (preceding::foo)[1] returns the first foo element in > document order, because the axis that applies to the [1] predicate is > the child axis. > > The note seems to be ambiguous in that it doesn't say whether the two > specifiers are being considered as expressions or as location paths, > but there are problems of interpretation either way. > > If they are considered as expressions, then preceding::foo[1] is a > location path treated as an expression while (preceding::foo)[1] is > directly an expression consisting of the parenthesized expr > (preceding::foo) narrowed by the predicate[1], and the child axis > isn't applied, despite what the note says. > > But if they are considered as location paths, then the location path > (preceding::foo)[1] seems to be an abbreviation of the location path > child::(preceding::foo)[1], and the selected nodes, order aside, are > the children of foo nodes rather than the foo nodes themselves. In > this case the two node-sets to which the [1] predicate is applied are > quite different. > > Am I misunderstanding this note or is there really something wrong > with it? > > Paul Abrahams > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Received on Thursday, 2 December 1999 03:27:01 UTC