<?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>17281</bug_id>
          
          <creation_ts>2012-06-01 10:14:12 +0000</creation_ts>
          <short_desc>[QT3TS] xqhof16, xqhof18</short_desc>
          <delta_ts>2012-10-05 15:58:55 +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>XQuery 3 &amp; XPath 3 Test Suite</component>
          <version>Working drafts</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="Tim Mills">tim</reporter>
          <assigned_to name="O&apos;Neil Delpratt">oneil</assigned_to>
          <cc>mike</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>68486</commentid>
    <comment_count>0</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2012-06-01 10:14:12 +0000</bug_when>
    <thetext>Test xqhof16 makes use of fn:static-base-uri.

declare base-uri &quot;main&quot;;
import module namespace lib = &quot;lib&quot;;

lib:getfun()(),
fn:static-base-uri#0(),
fn:static-base-uri()


There are several problems with this test.  As it currently stands, in XQ30 fn:static-base-uri doesn&apos;t return the static base uri.  Therefore the base-uri declaration has no bearing on the result.  Even if it did, &quot;main&quot; is a relative URI, and thus fn:static-base-uri still might (would?) not return &quot;main&quot;.

With the current definition of fn:static-base-uri, this will return the same result regardless of the module in which it appears.

There are similar problems in xqhof18.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68487</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2012-06-01 10:32:27 +0000</bug_when>
    <thetext>Would it help if we stated a constraint on the test environment that the dynamic base URI of every module is the same as its static base URI? I would expect that to be easily achieved for most implementations, simply by executing the query in the same location as where the source code is located.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68488</commentid>
    <comment_count>2</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2012-06-01 10:37:44 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; Would it help if we stated a constraint on the test environment that the
&gt; dynamic base URI of every module is the same as its static base URI? I would
&gt; expect that to be easily achieved for most implementations, simply by executing
&gt; the query in the same location as where the source code is located.

It might lead to some implementation bugs being more difficult to tease out.  Note that this test uses a module.  There&apos;s a call to fn:static-base-uri from lib which the test author believed would return lib, when in fact it should be (in XQ30) the dynamic base URI.

I really do not like having fn:static-base-uri returning something which isn&apos;t the static base URI.  It just leads to confusion.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68493</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2012-06-01 11:03:55 +0000</bug_when>
    <thetext>&gt;I really do not like having fn:static-base-uri returning something which isn&apos;t
the static base URI.  It just leads to confusion.

I agree wholeheartedly. That&apos;s why I resisted this choice of terminology. I would much prefer to call the two concepts &quot;source location&quot; and &quot;deployment location&quot; and have static-base-uri return the &quot;deployment location&quot;. That far better reflects the original intent of the split.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68497</commentid>
    <comment_count>4</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2012-06-01 11:24:19 +0000</bug_when>
    <thetext>As we&apos;re stuck with fn:static-base-uri() for compatibility with F&amp;O 1.0, I&apos;d suggest fn:current-uri() for the dynamic base URI/deployment location, because so many of the dynamic context accessors start with &quot;current&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68499</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2012-06-01 11:36:56 +0000</bug_when>
    <thetext>The problem is that in practice, the static-base-uri() function is used to locate resources such as lookup documents (configuration files etc) which exist in the dynamic environment where the query is deployed; it is not used to find out where the source code was when it was compiled. 

For compatibility, static-base-uri() needs to continue to return the deployment location. We don&apos;t need a function to tell you where the source code was when it was compiled: there is no reason we should want to make this information available.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68504</commentid>
    <comment_count>6</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2012-06-01 12:15:03 +0000</bug_when>
    <thetext>(In reply to comment #5)
&gt; The problem is that in practice, the static-base-uri() function is used to
&gt; locate resources such as lookup documents (configuration files etc) which exist
&gt; in the dynamic environment where the query is deployed; it is not used to find
&gt; out where the source code was when it was compiled. 
&gt; 
&gt; For compatibility, static-base-uri() needs to continue to return the deployment
&gt; location. We don&apos;t need a function to tell you where the source code was when
&gt; it was compiled: there is no reason we should want to make this information
&gt; available.

I&apos;m afraid I don&apos;t agree with this.  An XQuery base-uri declaration can set the base URI to any value it likes.  It need have no relation to either where the source code resided or to the URI at query is deployed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68510</commentid>
    <comment_count>7</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2012-06-01 13:06:08 +0000</bug_when>
    <thetext>&gt;An XQuery base-uri declaration can set the base URI to any value it likes.

Not sure I understand what you&apos;re saying here. We seem to have decided that the base-uri declaration affects only the &quot;static base URI&quot;, which means it&apos;s only used (directly) for resolving compile-time things like import module and import schema. I would expect most implementations to make the static base URI and dynamic base URI the same by default, in which case I guess it will determine the dynamic base URI as well, but I don&apos;t quite see the relevance of this to your remark.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68513</commentid>
    <comment_count>8</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2012-06-01 13:30:29 +0000</bug_when>
    <thetext>(In reply to comment #7)
&gt; &gt;An XQuery base-uri declaration can set the base URI to any value it likes.
&gt; 
&gt; Not sure I understand what you&apos;re saying here. We seem to have decided that the
&gt; base-uri declaration affects only the &quot;static base URI&quot;, which means it&apos;s only
&gt; used (directly) for resolving compile-time things like import module and import
&gt; schema. I would expect most implementations to make the static base URI and
&gt; dynamic base URI the same by default, in which case I guess it will determine
&gt; the dynamic base URI as well, but I don&apos;t quite see the relevance of this to
&gt; your remark.

As you&apos;ve pointed out, in XQuery 1.0 there was no distinction between the static base URI and the dynamic base URI.  Providing both are the same, existing XQuery 1.0 queries will continue to be unaffected when run under a 3.0 processor.

However, one cannot always guarantee that the staitc base URI and dynamic base URI will be the same.  This has the potential to break existing queries.  Examples of this include use of a function which relies on the static base URI from a library module whose static base URI is different from the static base URI of the importing module.  Or something like:

&lt;?xml version=&quot;1.0&quot; ?&gt;
&lt;xsl:stylesheet version=&quot;2.0&quot; 
                xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;&gt;

  &lt;xsl:template match=&quot;/&quot;&gt;
    &lt;foo xml:base=&quot;http://www.exmaple.org/foo&quot;&gt;
      &lt;xsl:value-of select=&quot;static-base-uri()&quot; /&gt;
    &lt;/foo&gt;
    &lt;bar xml:base=&quot;http://www.exmaple.org/bar&quot;&gt;
      &lt;xsl:value-of select=&quot;static-base-uri()&quot; /&gt;
    &lt;/bar&gt;
  &lt;/xsl:template&gt;

&lt;/xsl:stylesheet&gt;

An XSLT 2.0 processor will produce

&lt;foo xml:base=&quot;http://www.exmaple.org/foo&quot;&gt;
http://www.exmaple.org/foo
&lt;/foo&gt;
&lt;bar xml:base=&quot;http://www.exmaple.org/bar&quot;&gt;
http://www.exmaple.org/bar
&lt;/bar&gt;

When using F&amp;O 3.0, this will surely be something like

&lt;foo xml:base=&quot;http://www.exmaple.org/foo&quot;&gt;
http://value/of/the/dynamic/base/URI
&lt;/foo&gt;
&lt;bar xml:base=&quot;http://www.exmaple.org/bar&quot;&gt;
http://value/of/the/dynamic/base/URI
&lt;/bar&gt;

Or am I missing something?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>74426</commentid>
    <comment_count>9</comment_count>
    <who name="O&apos;Neil Delpratt">oneil</who>
    <bug_when>2012-09-25 14:19:05 +0000</bug_when>
    <thetext>Following from spec changes I think this one can be closed now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>74432</commentid>
    <comment_count>10</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2012-09-25 15:13:58 +0000</bug_when>
    <thetext>I disagree.

I would expect fn:static-base-uri() to be returning absolute URIs.

The expected results are not absolute URIs.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>74931</commentid>
    <comment_count>11</comment_count>
    <who name="O&apos;Neil Delpratt">oneil</who>
    <bug_when>2012-10-01 15:49:12 +0000</bug_when>
    <thetext>(In reply to comment #10)
Yes I agree. I have changed the expected results of the test-cases so that we use the fn:ends-with() function.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>75042</commentid>
    <comment_count>12</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2012-10-02 12:54:57 +0000</bug_when>
    <thetext>&quot;The assert element contains an XPath expression whose effective boolean
value must be true; usually the expression will use the variable $result
which references the result of the expression. &quot;

The assertion 

&lt;assert&gt;fn:ends-with($result[1], &quot;lib&quot;), fn:ends-with($result[2], &quot;main&quot;), fn:ends-with($result[3], &quot;main&quot;)&lt;/assert&gt;&quot;

does not have an EBV. 

I suspect you meant

&lt;all-of&gt;
&lt;assert&gt;fn:ends-with($result[1], &quot;lib&quot;)&lt;/assert&gt;
&lt;assert&gt;fn:ends-with($result[2], &quot;main&quot;)&lt;/assert&gt;
&lt;assert&gt;fn:ends-with($result[3], &quot;main&quot;)&lt;/assert&gt;
&lt;/all-of&gt;

It might be better to omit the &quot;fn&quot; prefix, as this isn&apos;t a predefined namespace for XPath.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>75049</commentid>
    <comment_count>13</comment_count>
    <who name="O&apos;Neil Delpratt">oneil</who>
    <bug_when>2012-10-02 13:56:37 +0000</bug_when>
    <thetext>Yes you are right. I have made the fix to the expected results of both test cases.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>