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

[Bug 29727] New: [xslt30ts] aspiring-001

From: <bugzilla@jessica.w3.org>
Date: Sat, 09 Jul 2016 18:17:31 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-29727-523@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=29727

            Bug ID: 29727
           Summary: [xslt30ts] aspiring-001
           Product: XPath / XQuery / XSLT
           Version: Candidate Recommendation
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLT 3.0 Test Suite
          Assignee: abel.online@xs4all.nl
          Reporter: mike@saxonica.com
        QA Contact: public-qt-comments@w3.org
  Target Milestone: ---

(a) The test file aspiring-001.xsl is referenced as aspiring001.xsl in the test
catalog

(The other test files in the same directory are not referenced at all -
presumably this is work in progress).

(b) On running the test I get 

Error at char 22 in xsl:value-of/@select on line 73 column 75 of ncname.xsl:
  FOCH0001: codepoints-to-string(): invalid XML character [x14]

It seems that the template rule on line 62 has been called with the input
string 

"41-5A"

and that something is wrong with the hex-to-integer conversion. If we look at
the function

<xsl:function name="f:fromHex" as="xs:integer">
        <xsl:param name="in" />
        <xsl:variable name="val" select="function($v) { if($v ge 65) then $v -
55 else $v - 48 }" />
        <xsl:sequence select="sum(reverse(string-to-codepoints($in)) ! ($val(.)
* math:pow(16, position() - 1))) cast as xs:integer" />
    </xsl:function>

with $in = "41"

string-to-codepoints($in) = (52, 49)
$val(52) = -4
$val(49) = -6

I can't see the logic here...

I would suggest

<xsl:function name="f:fromHex" as="xs:integer">
   <xsl:param name="in" />
   <xsl:sequence select="
     if (string-length($in) = 0) then 0
     else if (string-length($in) = 1) 
          then string-length(substring-before('012..ef', $in))
     else f:fromHex(substring($in,1,1))*16 + f:fromHex(substring($in,2))"/>     
</xsl:function>

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
Received on Saturday, 9 July 2016 18:17:40 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:58:01 UTC