[Bug 2441] xqx: character references

http://www.w3.org/Bugs/Public/show_bug.cgi?id=2441





------- Comment #15 from davidc@nag.co.uk  2006-09-28 21:47 -------
> Well, it seems that the resolution of entity references and character
> references is not clearly defined...

I honestly am struggling to see any ambiguity in the current specification
and so I'm not sure I can really answer your questions in a helpful way but
I'll try.

> "Each predefined entity reference is replaced by the character it represents
> when the string literal is processed."

There are five predefined entities, including amp and that means that &
gets replaced by an ampersand character. The whole point of writing &
rather than & is to _stop_ it being used as markup so it is absolutely clear
that in XQuery as in XML 
Ӓis the 7 characters 7 # 1 2 3 4 ; not a reference to the character
with codepoint 1234. It would be absolutely bizare if Xquery were defined
otherwise, as it would be using XML syntax with completely different semantics.

> Are string-length("abc𝅖def") and string-length("abc𝅖def")?
> at least one XQuery processor I tried resolves these two strings to the same
> string value,
bugs happen, report it as a bug to that system's maintainers, That is
unquestionably a bug.

> So which characters should be replaced by entity refs when producing XQueryX? 
> Seems that the stylesheet assumes ",',<,> should be replaced but not &?
as always when writing xml (or xml-like) syntax you just need to quote those
characters that have special significance in XML, which includes &, and this is
what the stylesheet does, see the template name="quote" which
                          <xsl:with-param
name="toBeReplaced">&amp;</xsl:with-param>
                          <xsl:with-param
name="replacement">&amp;amp;</xsl:with-param>


David

Received on Thursday, 28 September 2006 21:47:09 UTC