W3C home > Mailing lists > Public > public-qt-comments@w3.org > July 2006

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

From: <bugzilla@wiggum.w3.org>
Date: Mon, 31 Jul 2006 13:09:43 +0000
CC:
To: public-qt-comments@w3.org
Message-Id: <E1G7XWh-0002Ao-R2@wiggum.w3.org>

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





------- Comment #8 from davidc@nag.co.uk  2006-07-31 13:09 -------
In addition to quoting all white space in attribute values, the stylesheet
needs to quote (just) #13 in strings, otherwise it interacts badly with the
XQuery line ending normalisation. essentially the rule needs to be that because
the stylesheet is using xsl:output method="text" it needs to do "by hand" all
the XML quoting that would be automatic if  xsl:output method="xml" were used,
as the XQuery white space rules are designed to mimic the XML ones.

<x>&#13;&#10;</x>/string-length(.)

should evaluate to 2 It should (I claim) be encoded in XQueryX as shown below,
but the stylesheet generates

<x>{"
"}</x>/string-length(.)
on that with literal #13 and #10 characters which are merged into a single #10
when parsed, so this expression evaluates to 1.

If the stylesheet followed the rules of the serialisation spec's xml output,
then #13 would be serialised as &#13; (or something equivalent) and it would
then not be normalised to #10 on parsing.

David


<xqx:module xmlns:xqx="http://www.w3.org/2005/XQueryX">
   <xqx:mainModule>
      <xqx:queryBody>
         <xqx:pathExpr>
            <xqx:stepExpr>
               <xqx:filterExpr>
                  <xqx:elementConstructor>
                     <xqx:tagName>x</xqx:tagName>
                     <xqx:elementContent>
                        <xqx:stringConstantExpr>
                           <xqx:value>&#xD;&#xA;</xqx:value>
                        </xqx:stringConstantExpr>
                     </xqx:elementContent>
                  </xqx:elementConstructor>
               </xqx:filterExpr>
            </xqx:stepExpr>
            <xqx:stepExpr>
               <xqx:filterExpr>
                  <xqx:functionCallExpr>
                     <xqx:functionName>string-length</xqx:functionName>
                     <xqx:arguments>
                        <xqx:pathExpr>
                           <xqx:stepExpr>
                              <xqx:filterExpr>
                                 <xqx:contextItemExpr/>
                              </xqx:filterExpr>
                           </xqx:stepExpr>
                        </xqx:pathExpr>
                     </xqx:arguments>
                  </xqx:functionCallExpr>
               </xqx:filterExpr>
            </xqx:stepExpr>
         </xqx:pathExpr>
      </xqx:queryBody>
   </xqx:mainModule>
</xqx:module>
Received on Monday, 31 July 2006 13:09:46 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:57:13 UTC