2023-05-04 12:10 Hussein Shafie:
On 5/4/23 00:04, Leif H Silli wrote:
SVG and HTML are very similar w.r.g. how the language property of an
element is defined and works:
1) each have two language property attributes, a “native“
'lang' attribute plus the generic '[xml:lang]' attribute.
2) each permits <foo xml:lang="en" lang="en"/>
3) each forbids <foo xml:lang="fr" lang="en"/>
(the atributes must have the same content)
4) when consumed as XML, each spec allows
<foo xml:lang="fr" /> and
<foo lang="en" /> as well as
<foo xml:lang="en" lang="en"/>
5) Both gives priority to xml:lang, when consumed as XML.
6) Unlike SVG, HTML may also be consumed as text (text/html),
and then only the last two options are permitted:
<foo lang="en" /> as well as
<foo xml:lang="en" lang="en"/>
What should be the consequences? I my view, it should be that,
a) when someone works with a HTML document (as opposed to a XHTML
document), adding xml:lang without also adding lang, should trigger a
warning, or error. (Warning can be justified since it could be that a
HTML document will be consumed as XML - after all, XMLmind is an XML
editork.)
b) if someone specifies both xml:lang and lang but with different
values, an error should be displayed.
Makes sense. We will try to implement this validation in the next
version of XXE (probably as a Schematron).
Great!
By the way, from my perspective, I know that even if I work with
XHTML-flavour XML documents (as opposed to HTML-flavour) XML documents,
I would prefer to make text/HTML compatible documents. (I can explain my
reasons, if you are interested. But for instance, if I work with a
"fragment document", such as a document consisting of a HTML <table> for
inclusion (copy and paste of the source code) in a WordPress blog, then
I am not interested in having to delete the DOCTYPE which XXE keeps
inserting when I work with .html documents (or may be this isn’t an
issue, actually - ha, ha).) It also isn’t completely clear to me what
XXE considers an HTML document vs an XHTML document (but per the HTML5
spec, a HTML doc _must_ be a complete document, with <!DOCTYPE
HTML><html><head><title/><metaa charset="UTF-8"/></head><body/>, so the
answer perhaps gives itself ...)
Anyway, I would prefer to use <foo lang="en"/> or <foo xml:lang="en"
lang="en"/> even for such documents. Put differently, I am not sure that
it is smart to __not__ warn against <foo xml:lang="en"/> just because
the user is authoring an XHTML document (and not a HTML document).
Leif Halvard Silli
--
XMLmind XML Editor Support List
xmleditor-support@xmlmind.com
http://www.xmlmind.com/mailman/listinfo/xmleditor-support