[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: [XPath] is it legal ?

  • To: xml-dev@l...
  • Subject: Re: [XPath] is it legal ?
  • From: "G. Ken Holman" <gkholman@C...>
  • Date: Fri, 07 Apr 2006 08:13:05 -0400

no attribute xpath
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@C...
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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.