<?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>29608</bug_id>
          
          <creation_ts>2016-05-04 05:15:13 +0000</creation_ts>
          <short_desc>Fragment identifiers: fn:doc vs. fn:unparsed-text</short_desc>
          <delta_ts>2016-07-21 15:03:00 +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.1</component>
          <version>Candidate Recommendation</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="Christian Gruen">christian.gruen</reporter>
          <assigned_to name="Michael Kay">mike</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>126327</commentid>
    <comment_count>0</comment_count>
    <who name="Christian Gruen">christian.gruen</who>
    <bug_when>2016-05-04 05:15:13 +0000</bug_when>
    <thetext>I noticed that fragment identifiers are only allowed for fn:doc, but not for fn:unparsed-text. I assume there is a specific reason for that, but I could not find any hint in the XQFO specification. Would it be possible to add an explanatory phrase to one of the function definitions?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126328</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-05-04 10:49:51 +0000</bug_when>
    <thetext>The semantics of a fragment identifier depend on the media type. There is a well-defined interpretation of fragment identifiers for application/xml, but I&apos;m not aware of any for text/plain. Am I mistaken?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126330</commentid>
    <comment_count>2</comment_count>
    <who name="Christian Gruen">christian.gruen</who>
    <bug_when>2016-05-04 11:03:52 +0000</bug_when>
    <thetext>&gt; Am I mistaken?

I don’t think so. It was mostly my knowledge gap (and my vague assumption that others could have similar gaps) that led to this question. With the well-defined interpretation, do you refer to the XPointer working draft?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126376</commentid>
    <comment_count>3</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2016-05-08 19:46:09 +0000</bug_when>
    <thetext>The fragment identifier is defined with the MIME type of a document and may depend on the serving application.

W3C says this:
(https://www.w3.org/DesignIssues/Fragment.html)
&quot;The significance of the fragment identifier is a function of the MIME type of the object.[...]The fragment ID spec for a new MIME type should  be part of the MIME type registration process.&quot;

And RFC-3986 says: &quot;The fragment&apos;s format and resolution is [..] dependent on the media type [RFC2046] of a potentially retrieved representation. [..] Fragment identifier semantics are independent of the URI scheme and thus cannot be redefined by scheme specifications.&quot;

Here are some examples of such MIME types:

- RFC-5147 defines fragment ids for text/plain through &quot;char&quot; and &quot;line&quot;
- RFC-7111 defines it for text/csv for &quot;col&quot; and &quot;row&quot;
- RFC-3778 defines it for application/pdf (page no, section, ref etc)
- W3C has a Recommendation for Media Fragments: https://www.w3.org/TR/media-frags/
- Some languages support package download (like Python) and add the MD5 hash as a fragment identifier to the URI, which then either retrieves the whole document or an error (if the MD5 does not match). This could well be used with any resource.
- This same MD5 check, or a length-check is also part of RFC-5147.

So I think Christian has a good point and perhaps we should say something about it, and at the very least allow it with unparsed-text etc as well (in fact, I think we should allow it with any external resource).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126407</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-05-10 15:43:43 +0000</bug_when>
    <thetext>Noted in discussion:

(a) this is a new feature to introduce at a late stage and because of the interaction with the environment there&apos;s a lot of scope for quibbling about the exact spec; the chance of getting it right first time is small.

(b) doc() currently allows a fragment id and defines no semantics for it. Almost any attempt to define semantics for it would cause a compatibility problem for some implementations (or for their users...)

(c) unparsed-text() currently disallows a fragment id. If we were to allow it, we would probably have to leave the semantics implementation-defined if we want similar behaviour to doc(). It&apos;s not clear that&apos;s desirable.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126408</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-05-10 15:56:03 +0000</bug_when>
    <thetext>We resolved to make no change to what&apos;s allowed/disallowed but to add editorial notes explaining the effect of fragment identifiers in the doc() function.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126694</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-06-07 15:02:14 +0000</bug_when>
    <thetext>fn:doc has a list of things where the behaviour of the function is implementation-defined, and I have added to this list:

&lt;p diff=&quot;add&quot; at=&quot;E&quot;&gt;The effect of a fragment identifier in the supplied URI is implementation-defined. One possible interpretation is to treat the fragment identifier as an ID attribute value, and to return a document node having the element with the selected ID value as its only child.&lt;/p&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>