<?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>8810</bug_id>
          
          <creation_ts>2010-01-25 09:49:51 +0000</creation_ts>
          <short_desc>[FO 1.1] resolve-uri() and the various RFCs</short_desc>
          <delta_ts>2010-12-10 17:44:38 +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 3.0</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="Michael Kay">mike</reporter>
          <assigned_to name="Michael Kay">mike</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>31192</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2010-01-25 09:49:51 +0000</bug_when>
    <thetext>In the current 1.0/2.0 specification (including in particular erratum FO.E1)

- fn:resolve-uri() says you can use either RFC 2396 or RFC 3986

- In XSLT 2.0, document() says you must use 3986

- fn:doc() just says you resolve the URI, without further elaboration.

I propose that in 1.1/2.1:

- fn:resolve-uri() should point to RFC 3986 only, and use more prescriptive wording: change &quot;using an algorithm such as those described in [RFC 2396] or [RFC 3986]&quot; to &quot;using the algorithm described in section 5.2 of [RFC 3986]&quot;, but retain (mutatis mutandis) the Note that says &quot;The algorithm in the cited RFC includes some variations that are optional or recommended rather than mandatory; it also describes some common practices that are not recommended, but which are permitted for backwards compatibility. Where the cited RFC permits variations in behavior, so does this specification.&quot;

- all other places where we talk about resolving relative URIs should point to rn:resolve-uri().

A particular technical issue with RFC 2396 is the handling of the relative URI &quot;&quot;. RFC 2396 in section 4.2 is clear that this is a &quot;same-document reference&quot;, but the URI resolution algorithm in section 5.2 does not treat it as such: the algorithm given relative=&quot;&quot;, base=&quot;http://example.com/dir&quot; returns &quot;http://example.com/&quot;. This is fixed in the algorithm given in section 5.2 of RFC 3986.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>31672</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2010-02-09 17:03:43 +0000</bug_when>
    <thetext>2010-02-09 - proposal accepted in principle, action on MHK to identify in detail the places that need to be changed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32763</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2010-03-02 16:00:08 +0000</bug_when>
    <thetext>First point: there&apos;s a contradiction here. In XSLT and XQuery, when we have to resolve a URI, we generally handle &quot;wannabe URIs&quot; according to the rules in XLink: that is, the URI is first percent-encoded to make it a valid RFC 3986 URI, then the URI resolution algorithm in the RFC is applied. The current spec for resolve-uri() does not do this (it rejects wannabe-URIs with an error). I propose that resolve-uri() should be changed to apply the escaping where needed.

Then the change to resolve-uri() is proposed as follows:

(0) Add phrasing to the effect: &quot;The URI references must conform to the same rules as the locator attribute (href) defined in section 5.4 of [XLink]; if necessary to make them valid according to RFC 3986, they are first percent-encoded.&quot; (Need to check the new XLink draft here).

(1) change &quot;If $relative is a relative URI reference, it is resolved against $base, or against the base-uri property from the static context, using an algorithm such as those described in [RFC 2396] or [RFC 3986], and the resulting absolute URI reference is returned.&quot; to

&quot;If $relative is a relative URI reference, it is resolved against $base, or against the base-uri property from the static context, using the algorithm  described in [RFC 3986], and the resulting absolute URI reference is returned.&quot;

(2) change the second note &quot;The algorithms in the cited RFCs...&quot; accordingly.

Second, several specs (XQuery, XSLT, F+O) make frequent reference to &quot;resolving&quot; a URI. These references can easily be found by searching (but take care, because the word is also used in other senses, e.g. resolving a namespace prefix). I propose that each of these specs contains the definition:

[DEFINITION: to *resolve* a relative URI is to expand it to an absolute URI, by reference to a base URI, as if by calling the function fn:resolve-uri.]

and that appropriate uses of the term resolve should be linked to this definition. The definition can go in 2.4.5 URI Literals for XQuery, in 6 Functions that manipulate URIs for F+O, and in 5.8 URI References for XSLT.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>43261</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2010-12-10 17:44:23 +0000</bug_when>
    <thetext>The proposal in comment #2 was accepted on 2010-05-14</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>