The tricky thing here is that a single lone slash can be either a
complete path expression or a part of a path expression. The XQuery
specification acknowledges the difficulties of parsing this ambiguity
here:

http://www.w3.org/TR/xquery/#parse-note-leading-lone-slash

I suppose the net of this is that the best practice is to *not* put
whitespace immediately after the leading slash of an XPath expression.

-Danny

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of David
Sewell
Sent: Tuesday, March 03, 2009 5:50 PM
To: [email protected]; General Mark Logic Developer Discussion
Subject: Re: [MarkLogic Dev General] Newline introduces parser bug?

It's not just newline. It looks like any whitespace before the second 
step in the location path causes an error:

    $v := $e/ c

doesn't work either.

Unless I am reading the XPath 2.0 spec completely incorrectly, 
whitespace there is ignorable whitespace and should indeed not be judged

as a syntax error:

http://www.w3.org/TR/xpath20/#IgnorableWhitespace


On Wed, 4 Mar 2009, Florent Georges wrote:

>
>  Hi,
>
>  I think I run into a parser bug.  The following query:
>
>    let $e := <e><c/></e>,
>        $v := $e
>                / c
>       return $v
>
> results in the following error:
>
>    XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error,
>    unexpected SlashOnly_
>
>  Of course, the following, equivalent query returns the expected
> result:
>
>    let $e := <e><c/></e>,
>        $v := $e/c
>       return $v
>
>  Regards,
>
> --
> Florent Georges
> http://www.fgeorges.org/
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
>

-- 
David Sewell, Editorial and Technical Manager
Electronic Imprint, The University of Virginia Press
PO Box 400318, Charlottesville, VA 22904-4318 USA
Courier: 310 Old Ivy Way, Suite 302, Charlottesville VA 22903
Email: [email protected]   Tel: +1 434 924 9973
Web: http://www.ei.virginia.edu/
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to