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 '6' 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"/>

SVG2: https://www.w3.org/TR/SVG2/struct.html#LangSpaceAttrs
HTML5: https://html.spec.whatwg.org/multipage/dom.html#the-lang-and-xml:lang-attributes

As showwn by validator.nu and validator.w3.org, the above can be validated: Both of them offers what I would call 'level 1' validation, by what I mean that they check whether the above rules are followed. And in addition, when 'level 1' is passed, they offer 'level 2' validation, by which I mean that they checks whether the content of the attributes matches the usage rules for the registered language tags.

XMLmind currently offers no validation of lang and xml:lang - neither level 1 nor level 2. I hereby suggest that 'level 1' validation is added. (Level 2 validation would of course also be welcome, but is far less fundamental).

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).








--
XMLmind XML Editor Support List
xmleditor-support@xmlmind.com
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to