<?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>6346</bug_id>
          
          <creation_ts>2009-01-03 16:37:08 +0000</creation_ts>
          <short_desc>[FO] fn:number() example</short_desc>
          <delta_ts>2009-01-28 20:58:16 +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>Functions and Operators 1.0</component>
          <version>Recommendation</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</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="Michael Kay">mike</reporter>
          <assigned_to name="Michael Kay">mike</assigned_to>
          <cc>jim.melton</cc>
          
          <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>22891</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2009-01-03 16:37:08 +0000</bug_when>
    <thetext>The second example for fn:number() (section 14.4.1) is:

fn:number($item2) returns NaN.

Now $item2 (scroll up to the start of section 14) is bound to an element of the form

  &lt;line-item&gt;
    &lt;description&gt; ... &lt;/description&gt;
    &lt;price&gt; ... &lt;/price&gt;
    &lt;quantity&gt;5.0&lt;/quantity&gt;
      ...
  &lt;/line-item&gt;

Since we are told that quantity is typed as xs:decimal, we must infer that this element is schema-validated, and it therefore seems highly likely that the line-item element would be defined with element-only content. In this situation I believe number() should fail with a type error; because although number() itself is resilient to casting errors, the atomization of the argument is done under the function calling rules and will fail in the case of element-only content.

I think it would be better to use a different example, say number($item1/description) (having given this element some non-numeric content).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>22892</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2009-01-03 16:47:20 +0000</bug_when>
    <thetext>Note also, fn:number() says twice that &quot;If $arg is the empty sequence, NaN is returned.&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>23288</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2009-01-28 20:57:52 +0000</bug_when>
    <thetext>Erratum E36 has been raised to fix the first problem. The second (duplication) does now harm and will be left alone. The bug is being marked fixed and closed.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>