Re: data-* attributes

On 03/11/2014 13:47, Peter Krautzberger wrote:
> Thanks for your comments, David.
>
>  > One reason [...]
>> isthat HTML moved away from grammar based syntax
>>(data-* being a good example of something that can't even be
> approximated in any of
>>dtd/RelaxNG or XSD schema).
>
> Right. Still, I'd argue that it is a significant use case. Perhaps there
> could be note suggesting a best practice for providing information in
> XML that would be represented as data-* in HTML.

In a pure XML context, attributes in (any) namespace would be the way:
data- is in some ways an html response to address that without the 
complication of namespaces. MathML even back as far as MathML1 has 
always allowed any attributes in other namespaces (in the prose and as 
far as possible in the grammar) The schemas allow it, DTD has a 
parameter entity that makes it easy to extend an initially empty set of
namespaced attributes, which is best you can do in DTD.

Trouble is (as you see already in aria: v aria- attributes) documents 
don't always live in purely xml or purely html contexts and "best 
practice" for switching between the two isn't always clear yet.

>
>>MathJax could easily ignore  [...]
>
> FWIW, MathJax wasn't the motivation for my question; this came out of
> questions regarding JATS. In practice, data-* works just fine; it's just
> not formally valid.

<mi jats:foo="bar"> is valid to the MathML3 schema (as long as jats: 
namespace is declared somewhere) it's just that you don't want to let 
attributes with colons in their name anywhere near an HTML parser, the
behaviour is specified but not particularly useful. So by spec the
implied suggestion is to have
<mi jats:foo="bar"> in XML and <mi data-jats-foo="bar"> in HTML
But just allowing the latter in XML would probably make everyone's life 
easier.



> Peter.
>
David

Received on Monday, 3 November 2014 14:00:38 UTC