RE: [XQuery]&[XPath] Different StringLiteral Definition in XPath 2.0 and XQuery 1.0

XQuery does expansion of XML-like entity references and character references
(such as & lt; and & #20ac;) on the fly. With XPath, it is assumed that such
expansion has already been done by the host language - in the case of XPath
embedded in an XML-based language such as XSLT, it will have been done by
the XML parser. You obviously don't want them to be dereferenced twice.
 
Michael Kay


  _____  

From: www-ql-request@w3.org [mailto:www-ql-request@w3.org] On Behalf Of
Kirmse, Daniel
Sent: 26 August 2004 07:38
To: 'www-ql@w3.org'
Subject: [XQuery]&[XPath] Different StringLiteral Definition in XPath 2.0
and XQuery 1.0



Hi,

is there a reason for the StringLiteral to be defined differently in
XPath2.0 and XQuery1.0? 

XQuery: 

[134]            <http://www.w3.org/TR/xquery/> StringLiteral      ::=
('"' ( <http://www.w3.org/TR/xquery/> PredefinedEntityRef |
<http://www.w3.org/TR/xquery/> CharRef | ('"' '"') | [^"&])* '"') | ("'" (
<http://www.w3.org/TR/xquery/> PredefinedEntityRef |
<http://www.w3.org/TR/xquery/> CharRef | ("'" "'") | [^'&])* "'")


XPath:

[73]     <http://www.w3.org/TR/xpath20/> StringLiteral      ::=
('"' (('"' '"') | [^"])* '"') | ("'" (("'" "'") | [^'])* "'")  


If I do interpret these rules correctly XPath StringLiterals may contain a
single '&' XQuery StringLiterals must not contain such a single '&'.

Assuming a string literal according to XQuery[134] 

"string that contains a single & character"

and an expression (that is equally defined in both grammars (XQuery[119],
XPath[58])

processing-instruction("string that contains a single & character")

For XQuery 1.0 this would a syntax error, for XPath 2.0 this would be
perfectly correct. How's this fitting to XPath 2.0 being a subset of XQuery
1.0?


Please advice,

Cheers,

Daniel

Received on Thursday, 26 August 2004 07:22:59 UTC