hixie: Rewrite how we patch XPath 1.0 for HTML5. (whatwg r4007)

hixie: Rewrite how we patch XPath 1.0 for HTML5. (whatwg r4007)

http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.3168&r2=1.3169&f=h
http://html5.org/tools/web-apps-tracker?from=4006&to=4007

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.3168
retrieving revision 1.3169
diff -u -d -r1.3168 -r1.3169
--- Overview.html 27 Sep 2009 09:09:20 -0000 1.3168
+++ Overview.html 28 Sep 2009 19:26:36 -0000 1.3169
@@ -215,7 +215,7 @@
    <h2 class="no-num no-toc" id="a-vocabulary-and-associated-apis-for-html-and-xhtml">A vocabulary and associated APIs for HTML and XHTML</h2>
    <!--ZZZ:-->
    <!--<h2 class="no-num no-toc">W3C Working Draft 25 August 2009</h2>-->
-   <h2 class="no-num no-toc" id="editor-s-draft-27-september-2009">Editor's Draft 27 September 2009</h2>
+   <h2 class="no-num no-toc" id="editor-s-draft-28-september-2009">Editor's Draft 28 September 2009</h2>
    <!--:ZZZ-->
    <dl><!-- ZZZ: update the month/day (twice), (un)comment out--><!--
     <dt>This Version:</dt>
@@ -317,7 +317,7 @@
   track.
   <!--ZZZ:-->
   <!--This specification is the 25 August 2009 Working Draft.-->
-  This specification is the 27 September 2009 Editor's Draft.
+  This specification is the 28 September 2009 Editor's Draft.
   <!--:ZZZ-->
   </p><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- relationship to other work (required) --><p>This specification is also being produced by the <a href="http://www.whatwg.org/">WHATWG</a>. The two specifications are
   identical from the table of contents onwards.</p><!-- UNDER NO CIRCUMSTANCES IS THE FOLLOWING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- context and rationale (required) --><p>This specification is intended to replace (be a new version of)
@@ -8329,18 +8329,63 @@
 
   <p id="xpath-1.0-processors">Implementations of XPath 1.0 that
   operate on HTML documents parsed or created in the manners described
-  in this specification (e.g. as part of the <code title="">document.evaluate()</code> API) are affected as
-  follows:</p>
+  in this specification (e.g. as part of the <code title="">document.evaluate()</code> API) must act as if the
+  following edit was applied to the XPath 1.0 specification.</p>
 
-  <p>A node test consisting of a <a href="http://www.w3.org/TR/REC-xml-names/#NT-QName">QName</a>
-  with no prefix (i.e. that matches the <a href="http://www.w3.org/TR/REC-xml-names/#NT-UnprefixedName">UnprefixedName</a>
-  production) must be treated as if it instead had the namespace URI
-  equal to <a href="#html-namespace-0">HTML namespace</a> when the node is an element
-  whose document is an <a href="#html-documents" title="HTML documents">HTML
-  document</a>. <a href="#refsXPATH10">[XPATH10]</a> <a href="#refsXMLNS">[XMLNS]</a></p>
+  <p>First, remove this paragraph:</p>
 
-  <p class="note">This requirement is a <a href="#willful-violation">willful violation</a>
-  of the XPath 1.0 specification, motivated by desire to have
+  <blockquote cite="http://www.w3.org/TR/1999/REC-xpath-19991116#node-tests">
+
+   <p>A <a href="http://www.w3.org/TR/REC-xml-names#NT-QName">QName</a> in the
+   node test is expanded into an <a href="http://www.w3.org/TR/1999/REC-xpath-19991116#dt-expanded-name">expanded-name</a>
+   using the namespace declarations from the expression context.  This
+   is the same way expansion is done for element type names in start
+   and end-tags except that the default namespace declared with <code title="">xmlns</code> is not used: if the <a href="http://www.w3.org/TR/REC-xml-names#NT-QName">QName</a> does
+   not have a prefix, then the namespace URI is null (this is the same
+   way attribute names are expanded).  It is an error if the <a href="http://www.w3.org/TR/REC-xml-names#NT-QName">QName</a> has a
+   prefix for which there is no namespace declaration in the
+   expression context.</p>
+
+  </blockquote>
+
+  <p>Then, insert in its place the following:</p>
+
+  <blockquote cite="http://www.w3.org/Bugs/Public/show_bug.cgi?id=7059#c37">
+
+   <p>A QName in the node test is expanded into an expanded-name using
+   the namespace declarations from the expression context. If the
+   QName has a prefix, then there must be namespace declaration for
+   this prefix in the expression context, and the correponding
+   namespace URI is the one that is associated with this prefix.  It
+   is an error if the QName has a prefix for which there is no
+   namespace declaration in the expression context. </p>
+
+   <p>If the QName has no prefix and the principal node type of the
+   axis is element, then the default element namespace is
+   used. Otherwise if the QName has no prefix, the namespace URI is
+   null. The default element namespace is a member of the context for
+   the XPath expression. The value of the default element namespace
+   when executing an XPath expression through the DOM3 XPath API is
+   determined in the following way:</p>
+
+   <ol><li>If the context node is from an HTML DOM, the default element
+    namespace is "http://www.w3.org/1999/xhtml".</li>
+
+    <li>Otherwise, the default element namespace URI is null.</li>
+
+   </ol><p class="note">This is equivalent to adding the default element
+   namespace feature of XPath 2.0 to XPath 1.0, and using the HTML
+   namespace as the default element namespace for HTML documents. It
+   is motivated by the desire to have implementations be compatible
+   with legacy HTML content while still supporting the changes that
+   this specification introduces to HTML regarding the namespace used
+   for HTML elements, and by the desire to use XPath 1.0 rather than
+   XPath 2.0.</p>
+
+  </blockquote>
+
+  <p class="note">This change is a <a href="#willful-violation">willful violation</a> of
+  the XPath 1.0 specification, motivated by desire to have
   implementations be compatible with legacy content while still
   supporting the changes that this specification introduces to HTML
   regarding which namespace is used for HTML elements. <a href="#refsXPATH10">[XPATH10]</a></p> <!-- note: version matters for

Received on Monday, 28 September 2009 19:27:46 UTC