[Bug 7059] [blocked on xpathwg] Forking XPath

http://www.w3.org/Bugs/Public/show_bug.cgi?id=7059





--- Comment #15 from Henri Sivonen <hsivonen@iki.fi>  2009-06-30 06:31:57 ---
(In reply to comment #14)
> As I understand, you want a path expression with no prefixes to match elements
> from either documents whose HTML elements are in no namespace, or documents
> whose HTML elements are in the HTML namespace.

No. As of HTML5, HTML elements (elements that implement the HTMLElement DOM
interface) are always in the http://www.w3.org/1999/xhtml namespace (like with
TagSoup). Elements that aren't in a namespace aren't HTML elements (and,
therefore, don't implement the HTMLElement interface). All parser-inserted
element nodes in HTML documents are in one of these three namespaces:
http://www.w3.org/1999/xhtml
http://www.w3.org/2000/svg
http://www.w3.org/1998/Math/MathML

The HTMLness of a document is an implementation-internal boolean on the object
that implements the Document interface. "HTML document" refers to a DOM tree
with the HTMLness bit set--not to the byte stream. ("Document" refers to the
parsed representation--not to the source text here.)

No-namespace nodes can be introduced to HTML documents only by a script calling
createElementNS(null, ...) or by moving a no-namespace node from an XML
document into an HTML document. 

(Note that XSLT cannot introduce no-namespace nodes into HTML documents,
because the namespace is changed to http://www.w3.org/1999/xhtml when an XSLT
program tries to do so: bug 6776. Also note that XSLT programs still can
introduce no-namespace nodes into XML documents, i.e. documents whose HTMLness
bit is false.)

For compatibility with existing XPath 1.0 expressions whose authors have
assumed that HTML elements aren't in a namespace, no-namespace XPath
expressions need to match against nodes whose namespace is
http://www.w3.org/1999/xhtml when the owner document of those nodes has been
marked as an HTML document. 

> As I understand, this affects only document.evaluate(), which applies only to
> one document at a time.

This affects any API that allows the evaluation of XPath expressions against
DOM trees whose HTMLness bit is true. Thus, it also applies to the
XSLTProcessor API:
https://developer.mozilla.org/en/Using_the_Mozilla_JavaScript_interface_to_XSL_Transformations

Note that when XSLT is applied to an XML document that has the xml-stylesheet
PI and that is being loaded from the network, the input DOM doesn't have the
HTMLness bit set, so this doesn't apply.


-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Tuesday, 30 June 2009 06:32:06 UTC