[html5] r4007 - [e] (0) Rewrite how we patch XPath 1.0 for HTML5. Fixing http://www.w3.org/Bugs/ [...]

whatwg at whatwg.org whatwg at whatwg.org
Mon Sep 28 12:34:49 PDT 2009


Author: ianh
Date: 2009-09-28 12:34:49 -0700 (Mon, 28 Sep 2009)
New Revision: 4007

Modified:
   index
   source
Log:
[e] (0) Rewrite how we patch XPath 1.0 for HTML5.
Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=7059

Modified: index
===================================================================
--- index	2009-09-27 09:17:15 UTC (rev 4006)
+++ index	2009-09-28 19:34:49 UTC (rev 4007)
@@ -112,7 +112,7 @@
   <div class=head>
    <p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG src=/images/logo></a></p>
    <h1>HTML5</h1>
-   <h2 class="no-num no-toc" id=draft-standard-—-27-september-2009>Draft Standard — 27 September 2009</h2>
+   <h2 class="no-num no-toc" id=draft-standard-—-28-september-2009>Draft Standard — 28 September 2009</h2>
    <p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
    <p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
    <!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
@@ -9366,18 +9366,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

Modified: source
===================================================================
--- source	2009-09-27 09:17:15 UTC (rev 4006)
+++ source	2009-09-28 19:34:49 UTC (rev 4007)
@@ -9682,21 +9682,72 @@
   <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>
+  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 <span>HTML namespace</span> when the node is an element
-  whose document is an <span title="HTML documents">HTML
-  document</span>. <a href="#refsXPATH10">[XPATH10]</a> <a
-  href="#refsXMLNS">[XMLNS]</a></p>
+  <p>First, remove this paragraph:</p>
 
-  <p class="note">This requirement is a <span>willful violation</span>
-  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 <span>willful violation</span> 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




More information about the Commit-Watchers mailing list