OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: [xml-dev] [XPath] is it legal ?

[ Lists Home | Date Index | Thread Index ]

At 2006-04-07 13:59 +0200, Philippe Poulard wrote:
>as everything is a node, one can match a node like this :
>     node()
>which works well in the axis that are walking through the tree
>what about other axis ?
>     @node()
>     namespace::node()
>which would give the same as (respectively) :
>     @*
>     namespace::*
>and above all what about :
>     @comment()
>     @text()
>     @p-i(target)
>     namespace::comment()
>     namespace::text()
>     namespace::p-i(target)
>which are all empty if they are legal
>but are they legal ?

Absolutely.  Even "/.." which is often used.

>(does an XPath parser must complain ?)

Not at all ... if it cannot find the node you asked for (which will 
never be there), then you just get the empty node set.

>here are the last ones :
>     /@*
>     /namespace::*
>All are accepted with Jaxen
>I didn't read anything in the spec that makes them illegal

They are not illegal.

A location step in a location path has a syntax and if you follow the 
syntax it is not illegal.  If you try to address something that is 
never there, it is not an error, but might very well be confusing to 
the reader and maintainer of your stylesheet.

>Will you be hurted if someone (like me) was writting something like this :
>     $foo/@bar/@oof

That will always return the empty set, since there is no attribute 
axis off of an attribute axis.

I hope this helps.

. . . . . . . . . Ken

Registration open for XSLT/XSL-FO training: Wash.,DC 2006-06-12/16
Also for XML/XSLT/XSL-FO training:    Birmingham, UK 2006-05-22/25
World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman                 mailto:gkholman@CraneSoftwrights.com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/x/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05  http://www.CraneSoftwrights.com/x/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS