<?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>3718</bug_id>
          
          <creation_ts>2006-09-13 14:26:38 +0000</creation_ts>
          <short_desc>fn:index-of</short_desc>
          <delta_ts>2007-02-25 23:34:32 +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>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="Tim Mills">tim</reporter>
          <assigned_to name="Ashok Malhotra">ashok.malhotra</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>11650</commentid>
    <comment_count>0</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2006-09-13 14:26:38 +0000</bug_when>
    <thetext>The summary of this function does not describe how to compare values of type xs:untypedAtomic.

In contrast, fn:distinct-values says &quot;Values of type xs:untypedAtomic are compared as if they were of type xs:string.&quot;  There are similar phrases covering fn:sum, fn:min, fn:max and fn:avg.

Should this phrase be added to fn:index-of?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>11654</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2006-09-13 15:01:30 +0000</bug_when>
    <thetext>I think the phrase:

The items in the sequence $seqParam are compared with $srchParam under the rules for the eq operator

makes it unambiguous.

Michael Kay (personal response)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>11656</commentid>
    <comment_count>2</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2006-09-13 15:37:24 +0000</bug_when>
    <thetext>Fair point.  The reason we came across this was because under the Formal Semantics normalization  for function calls, we get:

fn:index-of($seqParam as xs:anyAtomicType*, $srchParam as xs:anyAtomicType)

fn:index-of(
  fs:convert-simple-operand(
    fs:data($seqParam as xs:anyAtomicType*),
    PrototypicalValue(xs:anyAtomicType))
  fs:convert-simple-operand(
    fs:data($srchParam as xs:anyAtomicType*)),
    PrototypicalValue(xs:anyAtomicType)))

I haven&apos;t found a definition for the PrototypicalValue for xs:anyAtomicType.  (The spec does define it as an xs:double for numeric arguments).

Our resolution has been to choose the PrototypicalValue based on whether we are dealing with avg, min, max, sum (treat as xs:double) or index-of, distinct-values (treat as xs:string).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>11864</commentid>
    <comment_count>3</comment_count>
    <who name="Jerome Simeon">simeon</who>
    <bug_when>2006-09-19 16:39:11 +0000</bug_when>
    <thetext>I think I agree with both Tim and Michael, if they allow me. The fact that the definition relies on eq makes it unambiguous. i.e., xs:untypedAtomic gets cast to xs:string. It would be worth spelling it out explicitely as all other functions do (fn:index-of seems to be quite similar to fn:distinct-values to that respect). So using xs:string for the PrototypicalValue as Tim suggests in his last comment is the right thing to do here.
- Jerome
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>14118</commentid>
    <comment_count>4</comment_count>
    <who name="Jim Melton">jim.melton</who>
    <bug_when>2007-02-25 23:34:32 +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>