[Bug 3446] [XQueryX] constructing attribute values with whitespace characters

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


jim.melton@acm.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED




------- Comment #4 from jim.melton@acm.org  2006-07-29 02:30 -------
Thanks for this report.  However, I must be missing something important. 

When I create the following XQuery (derived from the XQueries that appeared in
this bug report):
   <x><elem attr="a&#x09;b"></elem><y/><elem attr="a    b"></elem></x>
(where the value of the attr attribute of the second elem element contains a
literal ASCII horizontal tab) and run it through at least one XQuery processor
(Stylus Studio 6 Enterprise Edition Release 3), the result is serialized as:
   <x><elem attr="a     b"/><y/><elem attr="a   b"/></x>
where the gap between the 'a' and 'b' is the control character with the value 9
(that is, in ASCII, a horizontal tab) in BOTH attributes! 

I'm afraid that I do not see the difference between the two. 

Therefore, I feel that I must dispute the claim that "[The second] XQuery will
not produce the same result as the XQuery that I desire." To the best of my
ability to tell, the two XQueries produce identical results. 

I infer, however, that you would prefer for the generated XQuery expression to
include an attribute whose value is "a&#x09;b" (with the six visible characters
between the 'a' and 'b'). 

Clearly, the first XQueryX attempt
(<xqx:attributeValue>a&#x09;b</xqx:attributeValue>) cannot do what you wish,
because the XML parser that transforms the XQueryX document into its internal
form for transformation turns the '&#x09;' into a literal tab character. 

The second attempt ((<xqx:attributeValue>a&amp;#x09;b</xqx:attributeValue>)
should do what you wish, because the XML parser translates the '&amp;' into a
literal ampersand.  However, the XQueryX stylesheet contains code that always
transforms literal ampersands into '&amp;' to preserve them (consider the
XQuery expression 'element a {This & that}', !  Therefore, this attempt does
not give the desired results.

It would appear that the stylesheet should not, in fact, be transforming '&'
(ampersand) characters into '&amp;' entity references, because there are no
places in an XQuery or in an XQueryX document where a "naked" ampersand can
occur, so there is no reason to "preserve" them. 

Right? 

The escaping of '&' to '&amp;' has been removed from the stylesheet, but all
reviewers are urged to enter another response if there are situations in which
an XQueryX document can contain legitimate ampersands that must be escaped. 

Received on Saturday, 29 July 2006 02:30:20 UTC