<?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>1512</bug_id>
          
          <creation_ts>2005-06-29 14:03:08 +0000</creation_ts>
          <short_desc>editorial suggestion for fn:min and fn:max</short_desc>
          <delta_ts>2007-02-25 23:40: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>Last Call drafts</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</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>minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Joanne Tong">joannet</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>4379</commentid>
    <comment_count>0</comment_count>
    <who name="Joanne Tong">joannet</who>
    <bug_when>2005-06-29 14:03:08 +0000</bug_when>
    <thetext>What should be the result of evaluating the following XPath expression? 

fn:max((xs:integer(&apos;10&apos;), xs:float(&apos;1&apos;))) instance of xs:integer 

     The description of fn:max says that it &quot;Selects an item from the input 
sequence $arg whose value is greater than or equal to the value of every other 
item in the input sequence.&quot;  It goes on to say that &quot;For numeric values, the 
numeric promotion rules defined in 6.2 Operators on Numeric Values are used to 
promote all values to a single common type.&quot;  Does the function return the 
promoted value that is greatest, or does it return the item from the original 
sequence whose promoted value is greatest? 

     The following example appears under fn:min.  It seems to indicate that the 
promoted value should be returned, but so far as I can tell, the descriptions 
of fn:min and fn:max don&apos;t state that explicitly. 

fn:min((5, 5.0e0)) returns 5.0e0 

     I believe the intention of the WG is to return the promoted value, and 
that the description of fn:min and fn:max should be clear that an item from the 
converted sequence (instead of the input sequence) should be returned.  I also 
noticed that the rules listed in the description of fn:max are disorganized.  I 
suggest the following replacement text for fn:max (and similarly for fn:min) 
starting from the second paragraph to the link 7.3.1 Collations.

---------------------------------------------------------- 

The following rules may be applicable to the input sequence.  If a resulting 
sequence exists after applying these rules, then it is referred to as the 
converted sequence.  This function would then return an item from the converted 
sequence rather than the input sequence.  The items in the converted sequence 
may be reordered in an arbitrary order. 

·    Any values of type xdt:untypedAtomic in the input sequence $arg are cast 
to xs:double. 
·    For numeric values, the numeric promotion rules defined in 6.2 Operators 
on Numeric Values are used to promote all values to a single common type. 
·    Duration values must either all be xdt:yearMonthDuration values or must 
all be xdt:dayTimeDuration values. 
·    All items in $arg must be numeric or derived from a single base type for 
which the gt operator is defined. In addition, the values in the sequence must 
have a total order.   
·    If any of these conditions is not met, then a type error is raised 
[err:FORG0006]. 

In addition, the following rules may be applicable to the input or converted 
sequence: 

·    If the sequence is empty, the empty sequence is returned. 
·    If date/time values do not have a timezone, they are considered to have 
the implicit timezone provided by the dynamic context for purposes of 
comparison. 
·    If the sequence contains the value NaN, the value NaN is returned. 
·    If the items in the value of $arg are of type xs:string or types derived 
by restriction from xs:string, then the determination of the item with the 
largest value is made according to the collation that is used. If the type of 
the items in $arg is not xs:string and $collation is specified, the collation 
is ignored. 
·    The collation used by the invocation of this function is determined 
according to the rules in 7.3.1 Collations. 

... 

---------------------------------------------------------- 

Thanks,
Joanne</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4410</commentid>
    <comment_count>1</comment_count>
    <who name="Ashok Malhotra">ashok.malhotra</who>
    <bug_when>2005-07-01 14:07:28 +0000</bug_when>
    <thetext>Thank you, Joanne!  I have clarified the wording for fn:min and fn:max taking
your suggestions into account.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>14133</commentid>
    <comment_count>2</comment_count>
    <who name="Jim Melton">jim.melton</who>
    <bug_when>2007-02-25 23:40:16 +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>