This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
I might want to construct an XQueryX instance that is equivalent to the following XQuery: <elem attr="&<>"></elem> I can try to do this with the following: <?xml version="1.0"?> <xqx:module xmlns:xqx="http://www.w3.org/2005/XQueryX" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2005/XQueryX http://www.w3.org/2005/XQueryX/xqueryx.xsd"> <xqx:mainModule> <xqx:queryBody> <xqx:elementConstructor> <xqx:tagName>elem</xqx:tagName> <xqx:attributeList> <xqx:attributeConstructor> <xqx:attributeName>attr</xqx:attributeName> <xqx:attributeValue>&<></xqx:attributeValue> </xqx:attributeConstructor> </xqx:attributeList> </xqx:elementConstructor> </xqx:queryBody> </xqx:mainModule> </xqx:module> The XQueryX stylesheet turns this into the following: <elem attr="&<>"></elem> This is not well-formed XML. Either attr="&<>" or attr="&<>" should be produced.
I think you're right that this is a bug, but to raise a technicality, the issue isn't whether <elem attr="&<>"></elem> is well-formed XML, it's whether it is well formed XQuery. As it happens it is neither. Michael Kay
to fix this one and bug #3446 the stylesheet will need to quote <, #9, #10, #13, in addition to & and { that are already handled. In xslt1 that's a deeply nested set of calls to the replace template. If xslt2 isn't an option (which could do this all with a single regexp-replace) another possiblity would be to translate <xqx:attributeValue>&<></xqx:attributeValue> to <elem attr="{"&<>"}"></elem> ^^ ^^ the extra {"..."} mean that you only need to take care of string-quoting rather than attribute constructor quoting (which I think the stylesheet already gets right) and the XQuery serialiser will then take care of the attribute value quoting rules for < and white space.
Thanks for your comment. I agree with the comment and have modified the stylesheet to properly escape "<" characters, in addition to the several others identified by bug #3446. I have marked this bug FIXED and encourage you to test the solution and, if you find it satisfactory, mark this bug CLOSED. (I will post the revised stylesheet shortly.)
Closing bug because commenter has not objected to the resolution posted and more than two weeks have passed.