W3C home > Mailing lists > Public > www-ql@w3.org > April to June 2001

Re: More on XQueryX paths

From: Michael Dyck <MichaelDyck@home.com>
Date: Sun, 17 Jun 2001 17:32:42 -0700
Message-ID: <3B2D4C2A.95570E77@home.com>
To: www-ql@w3.org
CC: Wayne Steele <xmlmaster@hotmail.com>
Howard Katz wrote:
> What's the syntax for longer path expressions? None of the examples
> show multi-step expressions having more than a single operator.

Actually, http://www.w3.org/TR/2001/WD-xqueryx-20010607#Example1 has a
three-step path:
    document("bib.xml")//book[publisher = $p]/price
which supposedly translates as
    <q:step axis="CHILD">
        <q:function name="document">
            <q:constant datatype="CHARSTRING">bib.xml</q:constant>
        <q:step axis="CHILD">
                    <q:function name="EQUALS">
although I suspect that first "axis" should be "SLASHSLASH".

> What if I want to say
>       /article/section
> Given the DTD, it looks like I have to recast this into AST form:
>               /
>      null          /
>             article   section
> so I can say something like this:
>      <q:query ...>
>           <q:step axis="CHILD">
>                 <q:identifier/>
>                 <q:step axis="CHILD">
>                     <q:identifier>article</q:identifier>
>                     <q:identifier>section</q:identifier>
>                 </q:step>
>           </q:step>
>      </q:query>
> Is that correct?

Apparently. Modulo the correct expression of absolute paths (your previous

For contrast, in Wayne Steele's XML Encoded XPath (XEXPath), these would
(I think) be expressed as follows:

    <!-- document("bib.xml")//book[publisher = $p]/price -->
        <function name="document">
        <descendant-or-self type="node" />

    <!-- /article/section -->

As you can see, XEXPath does *not* reflect the recursive tree structure of
path expressions, which makes them flatter, briefer, and (in my opinion)
easier to read.  For info on XEXPath, see:
and the 3 messages that follow that.

Received on Sunday, 17 June 2001 20:36:52 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:17:15 UTC