Thanks for considering this RFC!
A quick reply before bed … Sorry for being longish.
(3) Last issue first: What did I mean by «permit the user to displayed the files as XHTML in all current Web browers»?
Well, I can understand that it was perhaps unclear. Bike allows us to use whatever file suffix we want. Which is kind of cool! And so, we can already use the .xhtml suffix. And you should - already - be able to open a “bike.xhtml” file in whatever browser you like.
But, XHTML is actually XML - and XML is less “automatic” than HTML is.
For “regular” HTML (that is: non-XML-HTML), the namespace is not necessary to declare - even if you do not declare it, the namespace of HTML already is xmlns="http://www.w3.org/1999/xhtml"
. And it does not matter whether you declare it or not. It is permitted to declare it, but it does not have any effect.
Whereas for XHTML - which as I said, really is XML (which is a general format used for many markup languages) - for XHTML, it is necessary to declare the namespace. Yes, XML without the HTML namespace, is not XHTML - if that makes sense.
The effect of the HTML namespace, is related to the (default) CSS and other default behaviors. This effect is the same for non-XML-HTML as for XML-HTML (also known as XHTML). The difference is only - or at least primarily - that for XHTML, it is necessary to declare the namespace.
So if you save a bike file as “bike.xhtml” and open it in Firefox or another browser, the browser will tell you that the document has no style sheet information. And hence, it will be very uninteresting to look at the document.
But if you add the namespace declaration to the html element, the browser will know which default CSS to add to the document.
So in a summary, with the namespace declaration present, the browser will interpret the file (almost) the same way regardless of whether you save the file as “bike.html” or as “bike.xhtml”.
As for your first question:
(2) Bike’s indent attribute: I have not looked at the indent attribute. I did not know Bike used it. But this sounds like custom attribute that you have created. The HTML5 specification (which governs both HTML5 and XHTML5) has some rules for how to create custom attributes. The most general approach would be to create a data- attribute - something like this: data-indent=""
. This would be valid, out of the box. (There are also more involved way to create custom attributes - but I am not prepared to say more than this, right now.)
Anyway, to answer your question: even if you just do indent=""
, it is perfectly “safe” to add the namespace declaration. It is not related to the namespace declaration at all. It is perfectly OK, from XHTML’s point of view, to add custom attributes on XHTML.
I could imagine that your question is related to old days when XHTML sometimes was considered to be more “semantic” than HTML. And so, you fear that if you add a “unsemantic” indent=""
attribute, that this somehow break anything.
Or, another way I could understand your question: To declare an attribute as valid, can be a very involved process, if we are dealing with XML. But XML has two levels of “validity”: It has well-formedness - anything that isn’t well formed, will not be rendered by the browser. And the second level is “valid”. For something to be “valid”, there must exist a meta-document somewhere which declares certain elements and attributes as “valid”. (By “meta-document” I mean document type declarations and that kind of stuff.)
But for XHTML5 (and HTML5) one removed the requirement for such a “meta document” - at least when it comes to browsers. (For XHTML editors, then they typically operate with some kind of knowledge of which attributes and element are valid - but even an XHTML editor should be able to handle custom attributes.)
But, once again, use of custom attributes is not incompatible with the HTML namespace declaration. But I would recommend using data-indent=""
(unless doing so somehow destroys your project …) But – NB – this recommendation has nothing to do with XHTML vs HTML.
There is just one thing to be aware of when it comes to attributes in XML (including XHTML): If the indent=""
takes a value, then you must include the quotes: indent="<value>"
. You cannot do indent=<value>
. And if the attribute is an on/off attribute, which does not take a value (that is: if the attribute changes the behavior of its element simply by its presence), then, for XML-compatibility, you must do indent=""
. I.e you must do <foo indent="">
. You cannot simply do <foo indent >
…
(1) Adding the namespace declaration is not a promise. Just because someone adds the HTML namespace declaration to a HTML file, does not mean that the file MUST be XHTML. As I said, the HTML5 specification permits the namespace declaration to be present (on any element), without requiring that the document otherwise is XHTML compliant.
Sorry for my long reply. Hope it made some sense.