<?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>30106</bug_id>
          
          <creation_ts>2017-05-04 10:18:53 +0000</creation_ts>
          <short_desc>[xslt30ts] Test case use-package-204 and matching multiple packages with a version range, which package is chosen?</short_desc>
          <delta_ts>2019-02-26 01:27:06 +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>XSLT 3.0 Test Suite</component>
          <version>Proposed Recommendation</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>ASSIGNED</bug_status>
          <resolution></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="Abel Braaksma">abel.online</assigned_to>
          <cc>abel.braaksma</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>128564</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2017-05-04 10:18:53 +0000</bug_when>
    <thetext>The test case defines an environment containing 5 versions of package http://www.w3.org/xslt30tests/use-package-base-004, specifically 1.0.0, 2.0.0, 3.5.4, 2.0.0-alpha, and 2.0.0-beta.

The xsl:use-package specifies package-version=&quot;1.5 to 2.5&quot;

The test results assume that 2.0.0 will be chosen.

But the spec says(in §3.5.2)

This specification does not define how the implementation locates a package given its name and version. If several matching versions of a package are available, it does not define which of them is chosen.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128586</commentid>
    <comment_count>1</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2017-05-09 18:01:01 +0000</bug_when>
    <thetext>I follow your reasoning, but find it unfortunate. This means that the highest available version is *not* automatically chosen.

Consider NuGet: it has the option to select &quot;highest-major&quot; or &quot;highest-minor&quot;, or &quot;exact-match&quot;. We have the machinery to do the same, but we don&apos;t use that machinery...

I doubt we can change this (let alone at this stage). Though perhaps it is possible to add a recommended behavior, something like: &quot;Implementers are encouraged to select the highest version available.&quot;. This would prevent too much implementation independence without changing the spec normatively.

Anything else (not selecting the highest available version) seems rather odd to me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128587</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2017-05-10 08:29:35 +0000</bug_when>
    <thetext>I suspect the reason we didn&apos;t mandate selection of the highest version was to allow implementations to factor in other criteria: for example a catalog might label a particular version as &quot;preferred&quot; or &quot;stable&quot;, or it might have some kind of configuration parameter giving meaning to the NCName part of the version number e.g. 2.1-Saxon versus 2.1-Exselt.

I agree that &quot;highest version&quot; is the most sensible thing to do in the absence of other information (and the test proved useful because it was failing because of a Saxon bug!) Perhaps we should just add a test dependency &quot;highest_package_version&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128588</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2017-05-10 08:36:32 +0000</bug_when>
    <thetext>Another case where an implementation might reasonably choose not to use the highest version is if A requires B and C, B requires D version 2.3.1.4, and C requires D version * (any version). In that situation it makes sense for C to use the same version of D that B uses.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128914</commentid>
    <comment_count>4</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2017-10-09 20:20:46 +0000</bug_when>
    <thetext>Yes, that makes sense (re: your last comment), although that may result in different behavior in different situations. I think predictability is a better thing to have.

That said, since we won&apos;t be changing the spec in this regard, I do think it makes sense to add either an example or a Note in the spec that explains this particular situation.

I&apos;ve never considered this difference, and even though all examples in the package-version section say &quot;x.y or z.w matches range so and so&quot;, i.e., they use &quot;OR&quot;, it would be nice to have a specific example in XSLT that shows the use of the package-version attribute and the effect it has.

Something like:

Example: your package repository has version 1.2-alpha, 1.2, 1.2.1, 1.3 of package &quot;urn:Foo&quot; available and your processor can locate all of them, and you use the following declaration:

&lt;xsl:use-package name=&quot;urn:Foo&quot; package-version=&quot;1.2+&quot; /&gt;

Then it is processor-dependent whether your processor will load version 1.2, 1.2.1 or 1.3. However, it will never load 1.2-alpha.

Conversely, if you have 

&lt;xsl:use-package name=&quot;urn:Foo&quot; package-version=&quot;1.2.1, 1.4.*&quot; /&gt; 

Then every processor will always load package version 1.2.1, assuming your package repository will not include 1.4.x at some point.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>129571</commentid>
    <comment_count>5</comment_count>
    <who name="Abel Braaksma">abel.online</who>
    <bug_when>2019-02-26 01:23:50 +0000</bug_when>
    <thetext>(In reply to Abel Braaksma from comment #4)
&gt; it would be nice to have a specific example in XSLT that shows the
&gt; use of the package-version attribute and the effect it has.
While this would be &quot;nice&quot;, considering we are in REC status, I now think we shouldn&apos;t riddle the errata with (more) examples. Re-reading the comments below doesn&apos;t convince me something needs to be changed.

(In reply to Michael Kay from comment #2)
&gt; I agree that &quot;highest version&quot; is the most sensible thing to do in the
&gt; absence of other information (and the test proved useful because it was
&gt; failing because of a Saxon bug!) Perhaps we should just add a test
&gt; dependency &quot;highest_package_version&quot;.

I have now changed the XSD as follows:

- added &quot;package_version_resolution&quot; dependency
- value can have: highest_version, lowest_version, unspecified
- added documentation, though I think the intend is clear

I have fixed the following tests with this dependency:

- use-package-203
- use-package-204
- use-package-206
- use-package-210

Each is renamed to -203a etc, and a -203b/c (etc) have been added to allow for either outcome. 

Tests marked with &quot;unspecified&quot; behavior can be run by any processor.

Processors that support choosing the highest version in a range, should update their drivers to select the &quot;highest_version&quot;. If they support the lowest version in a range, then &quot;lowest_version&quot;.

Conversely, these dependencies could be used to switch the version-resolution algorithm, if a processor has such option.

I&apos;ll leave this bug open for any comments.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>