<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>3474</bug_id>
          
          <creation_ts>2006-07-17 22:09:26 +0000</creation_ts>
          <short_desc>[XQueryX] constructing attribute values with the less than character</short_desc>
          <delta_ts>2007-02-25 23:55:46 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>XQueryX 1.0</component>
          <version>Candidate Recommendation</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows XP</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Andrew Eisenberg">andrew.eisenberg</reporter>
          <assigned_to name="Jim Melton">jim.melton</assigned_to>
          
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>10548</commentid>
    <comment_count>0</comment_count>
    <who name="Andrew Eisenberg">andrew.eisenberg</who>
    <bug_when>2006-07-17 22:09:26 +0000</bug_when>
    <thetext>I might want to construct an XQueryX instance that is equivalent to the
following XQuery:

&lt;elem attr=&quot;&amp;amp;&amp;lt;&amp;gt;&quot;&gt;&lt;/elem&gt;

I can try to do this with the following:

&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;xqx:module xmlns:xqx=&quot;http://www.w3.org/2005/XQueryX&quot;
            xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
            xsi:schemaLocation=&quot;http://www.w3.org/2005/XQueryX
                                http://www.w3.org/2005/XQueryX/xqueryx.xsd&quot;&gt;
  &lt;xqx:mainModule&gt;
    &lt;xqx:queryBody&gt;
      &lt;xqx:elementConstructor&gt;
        &lt;xqx:tagName&gt;elem&lt;/xqx:tagName&gt;
        &lt;xqx:attributeList&gt;
          &lt;xqx:attributeConstructor&gt;
            &lt;xqx:attributeName&gt;attr&lt;/xqx:attributeName&gt;
            &lt;xqx:attributeValue&gt;&amp;amp;&amp;lt;&amp;gt;&lt;/xqx:attributeValue&gt;
          &lt;/xqx:attributeConstructor&gt;
        &lt;/xqx:attributeList&gt;
      &lt;/xqx:elementConstructor&gt;
    &lt;/xqx:queryBody&gt;
  &lt;/xqx:mainModule&gt;
&lt;/xqx:module&gt;

The XQueryX stylesheet turns this into the following:

&lt;elem attr=&quot;&amp;amp;&lt;&gt;&quot;&gt;&lt;/elem&gt;

This is not well-formed XML. Either attr=&quot;&amp;amp;&amp;lt;&gt;&quot; or attr=&quot;&amp;amp;&amp;lt;&amp;gt;&quot; should be produced.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>10550</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2006-07-18 01:02:19 +0000</bug_when>
    <thetext>I think you&apos;re right that this is a bug, but to raise a technicality, the issue isn&apos;t whether &lt;elem attr=&quot;&amp;amp;&lt;&gt;&quot;&gt;&lt;/elem&gt; is well-formed XML, it&apos;s whether it is well formed XQuery. As it happens it is neither.

Michael Kay</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>10554</commentid>
    <comment_count>2</comment_count>
    <who name="David Carlisle">davidc</who>
    <bug_when>2006-07-18 10:32:11 +0000</bug_when>
    <thetext>to fix this one and bug #3446 the stylesheet will need to quote &lt;, #9, #10, #13, in addition to &amp; and { that are already handled. In xslt1 that&apos;s a deeply nested set of calls to the replace template. If xslt2 isn&apos;t an option (which could do this all with a single regexp-replace) another possiblity would be to 
translate

 &lt;xqx:attributeValue&gt;&amp;amp;&amp;lt;&amp;gt;&lt;/xqx:attributeValue&gt;

to

&lt;elem attr=&quot;{&quot;&amp;amp;&lt;&gt;&quot;}&quot;&gt;&lt;/elem&gt;
            ^^        ^^

the extra {&quot;...&quot;} 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 &lt; and white space.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>10915</commentid>
    <comment_count>3</comment_count>
    <who name="Jim Melton">jim.melton</who>
    <bug_when>2006-08-01 01:14:51 +0000</bug_when>
    <thetext>Thanks for your comment. 

I agree with the comment and have modified the stylesheet to properly escape &quot;&lt;&quot; 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.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>14179</commentid>
    <comment_count>4</comment_count>
    <who name="Jim Melton">jim.melton</who>
    <bug_when>2007-02-25 23:55:46 +0000</bug_when>
    <thetext>Closing bug because commenter has not objected to the resolution posted and more than two weeks have passed.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>