<?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>11555</bug_id>
          
          <creation_ts>2010-12-15 14:36:27 +0000</creation_ts>
          <short_desc>[FO3.0] Requirement for path() function</short_desc>
          <delta_ts>2011-06-26 21:12:53 +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>
          <cc>jim.melton</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>43378</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2010-12-15 14:36:27 +0000</bug_when>
    <thetext>The original use case for the introduction of the EQName syntax was to allow users to generate a persistent path to a node that could then be fed back into the system to retrieve the original node. Such a path might take the form

&quot;http://ns1.uri/&quot;:doc[1]/&quot;http://ns1.uri/&quot;:chap[2]/&quot;http://ns1.uri/&quot;:section[4]

Well, we did half the job: we added EQNames, but we didn&apos;t add the ability to generate the path. A function to do so can be written by users, of course, but it&apos;s not trivial.

This entry proposes the addition of such a function.

(Note, XQuery still has no facility to evaluate a path presented as a string in this form. XSLT 3.0 does have this capability, in the form of the xsl:evaluate instruction.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>45891</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2011-02-21 16:07:42 +0000</bug_when>
    <thetext>Here is a proposed specification.

fn:path($node as node()) as xs:string

Summary: returns a path expression that can be used to select the supplied node relative to the root of its containing document.

Rules:
* If $node does not have a document node as an ancestor, an error is raised [TBA]

* If $node is a document node, the function returns the string &quot;/&quot;.

* Otherwise, the function constructs a string that consists of a sequence of steps, one for each ancestor-or-self of $node other than the document node. Each step consists of the character &quot;/&quot; followed by a string whose form depends on the kind of node selected by that step, as follows:

** For an element node, &quot;{uri}&quot;:{local}[{position}], where {uri} is the namespace URI of the node-name or the empty string if the node is in no namespace, {local} is the local part of the node-name, and {position} is an integer representing the position of the selected node among its like-named siblings

** For an attribute node:

--- if the node is in no namespace, @{local}, where {local} is the local part of the node-name

--- otherwise, @&quot;{uri}&quot;:{local}, where {uri} is the namespace URI of the node-name, and {local} is the local part of the node-name

** For a text node: text()[{position}] where {position} is an integer representing the position of the selected node among its text node siblings

** For a comment node: comment()[{position}] where {position} is an integer representing the position of the selected node among its comment node siblings

** For a processing-instruction node: processing-instruction({local])[{position}] where {local} is the name of the processing instruction node and {position} is an integer representing the position of the selected node among its like-named processing-instruction node siblings

** For a namespace node: namespace::{prefix}, where {prefix} is the local part of the name of the namespace node (which represents the namespace prefix).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50328</commentid>
    <comment_count>2</comment_count>
    <who name="Jim Melton">jim.melton</who>
    <bug_when>2011-06-26 21:12:16 +0000</bug_when>
    <thetext>In their Joint teleconference on 2011-05-10 (the minutes of which can be found at member-only URI http://lists.w3.org/Archives/Member/w3c-xsl-query/2011May/0131.html), the XML Query and XSLT WGs decided to adopt the proposal in comment #1 without changes, adding the fn:path() function to F&amp;O 3.0.  Based on this decision, I am marking this bug RESOLVED/FIXED.  Because you were present when the decision was made, I am also marking it CLOSED.  If you disagree with this resolution, please re-open the bug.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>