- From: Michael Kay <mike@saxonica.com>
- Date: Thu, 29 Dec 2022 12:51:07 +0000
- To: Reece Dunn <msclrhd@googlemail.com>, "public-xslt-40@w3.org" <public-xslt-40@w3.org>
- Message-ID: <B5A7A609-F005-47C4-8017-C506AD5992A6@saxonica.com>
I'm making progress, but struggling to know in some cases what the right answer should be. For example how should a comment that contains "--" be represented in the XDM? What about an rdf:rdf element? It certainly looks like the (non-)random selection of test cases I picked up will take us into some interesting corners of the spec. Mike On 28 Dec 2022, at 17:18, Reece Dunn <msclrhd@googlemail.com<mailto:msclrhd@googlemail.com>> wrote: On Wed, 28 Dec 2022 at 16:06, Michael Kay <mike@saxonica.com<mailto:mike@saxonica.com>> wrote: You need to use the `Document.outerHtml()` method in conjunction with the `Document.outputSettings()` properties to get it to serialize XHTML output. So you could do something like: Thanks. That helps, but it doesn't output a namespace declaration for the XHTML namespace. I'm tweaking the HtmlDocument -> DomDocument conversion to try and get namespaces right. One test has <script id='script' href='testScripts/externalScript1.js' xlink:href='testScripts/externalScript2.js'></script> Any idea what the expected XDM representation is? Do we recognize xlink as a magic prefix? The https://html.spec.whatwg.org/#attributes-2 (13.1.2.3 Attributes) section allows xlink:actuate, xlink:arcrole, xlink:href, xlink:role, xlink:show, xlink:title, xlink:type, xml:lang, xml:space, xmlns, and xmlns:xlink namespaced attributes for foreign (MathML and SVG) elements. It defines those namespaces in https://infra.spec.whatwg.org/#namespaces (8. Namespaces) where xlink is "http://www.w3.org/1999/xlink". Note also that MathML and SVG elements will be in those respective namespaces. Regarding the use of xlink on other (non-MathML/SVG elements), there is the following example in https://html.spec.whatwg.org/#coercing-an-html-dom-into-an-infoset (13.2.9 Coercing an HTML DOM into an infoset): > As another example, consider the attribute xlink:href. Used on a MathML element, it becomes, after being adjusted<https://html.spec.whatwg.org/#adjust-foreign-attributes>, an attribute with a prefix "xlink" and a local name "href". However, used on an HTML element, it becomes an attribute with no prefix and the local name "xlink:href", which is not a valid NCName, and thus might not be accepted by an XML API. It could thus get converted, becoming "xlinkU00003Ahref". - Reece
Received on Thursday, 29 December 2022 12:51:22 UTC