[xquery-talk] VarRef

Sijo Mathew sijo at atinav.com
Mon May 30 15:24:44 PDT 2005

Hi Scott,

Sorry, my language didn't convey the meaning clearly.
I am familiar with the [158] non-terminal defn of the 
XQuery spec.

Well, let me try to clarify it once again.
In XML grammar you cannot have a white space where 
ever that is not specified explicitly by using 'S'.

For example, look at the following grammar defn from 
the XML spec.

[44]EmptyElemTag   ::=   '<' Name (S Attribute)* S? '/>' 

Here, you CANNOT have a white space between '<' 
and the non-terminal 'Name'.

The following are from the XQuery spec.

[35]   PositionalVar   ::=   "at" "$" VarName
[79]    Wildcard    ::=    "*" | <NCName ":" "*"> | <"*" ":" 

If we assume as in the case of XML grammar, we CANNOT  
have white space between 'at' and '$', also between '$' and 
VarName. To have optional space between 'at' and '$', we 
should write "at" S? "$".

But, it seems, this is not the terminology followed by the 
XQuery grammar. That is what makes the confusion, I think.

Well, I shall list out another non-terminal defn which is used 
both in the XML and in the XQuery spec.
    Predefined entity references are used both in the XML and 
in the XQuery specification. The grammar defn follows.

>From XQuery grammar,
[147] PredefinedEntityRef    ::=    "&" ("lt" | "gt" | "amp" 
                                                    | "quot" | "apos") ";"

>From XML spec.
[68]    EntityRef    ::=    '&' Name ';'
And predefined entities are specified as amp, lt, gt, apos, quot

So, according to XQuery, white spaces are allowed between 
"&" symbol and "lt", but in XML which is NOT allowed.


----- Original Message ----- 
From: <scott_boag at us.ibm.com>
To: "Sijo Mathew" <sijo at atinav.com>
Cc: <talk at xquery.com>
Sent: Monday, May 30, 2005 11:40 AM
Subject: Re: [xquery-talk] VarRef

> > But, it seeems that, XQuery spec is not using the same in
> > such situations.
> Hi Sijo.  Which version of the draft are you looking at?  The XQuery 
> grammar clearly defines S as:
> [158]           S          ::= [http://www.w3.org/TR/REC-xml#NT-S]
> And later, when defining ignorable whitespace:
> Whitespace characters are defined by [http://www.w3.org/TR/REC-xml#NT-S]
> Certainly the intention is that the definition of whitespace use is the 
> same.  If you think you know of something where this isn't the case, 
> please post to the bug tracking system!
> > You could have defined the non-terminal 'VarRef ' as below,
> > 
> > [84] VarRef    ::=    "$" S? VarName
> > 
> > which will definitely help to avoid similar questions.
> We could, though the draft is currently clear on this.
> -scott

More information about the talk mailing list