W3C home > Mailing lists > Public > public-html-comments@w3.org > September 2011

xmlns:prefix frowned upon?

From: Luke Scott <luke@visionlaunchers.com>
Date: Sun, 4 Sep 2011 07:10:14 +0000
To: "public-html-comments@w3.org" <public-html-comments@w3.org>
Message-ID: <283FEC93C84E1248B931166DC960A8AA07049F4F@MBX204.domain.local>
Can someone please explain to me why xmlns:prefix no longer passed validation and is "frowned upon"?

Have any of you heard of TAL or PHPTAL? Using prefixed attributes is by far the best way of adding functionality to static templates. And it's hand authored!

As an example, this is what a lot of PHP template engines do:

{foreach $array as $row}
<div>
{$row->name}
</div>
{/foreach}

With PHPTAL/TAL you can do this:

<div tal:repeat="row array">
${row/name}
</div>

Or Even:

<div tal:repeat="row array" tal:content="row/name">
Default text!
</div>

With the first "{foreach}" example or "special" syntax seen in many template engines, it litters the static document. TAL/PHPTAL syntax keeps the original document intact and allows you to view and make changes to the original design. TAL, or any attribute style template engine, is designer friendly, whereas other syntaxes like "{foreach}" is not.

Another gem about TAL is you can select an element in Dreamweaver and add this special attribute without touching the code. You don't have to place a "{/foreach}" or "{/if}" in the right spot because the existing document is already in place. I have seen more people confused with these special syntaxes than with TAL.

Now I will admit that xmlns:tal="..." _is_ complicated. My _MAJOR_ complaint is that I cannot add custom attributes and validate the document. In my case these attributes will be stripped out when the document is compiled/cached, but I still have to validate/re-validate the static document and having the validator tell me that "tal:repeat" is not a valid attribute is not helpful.

To add to my frustration, editors such as Netbeans also flag these attributes as being invalid.

I know that HTML5 has a data-* attribute, but I would prefer not to have attributes such as data-repeat as that doesn't make sense. On top of that, I have my own template engine that makes use of attributes and my data-repeat would clash with theirs (if that was the only option).

All I want is some sort way of adding attribute prefixes so they are ignored by both the validator and the browser. I don't need these to work in Javascript, I just don't want the validator or browser freaking out... (I may want to use CSS to highlight tags with these attributes, or make some sort of user interface in Javascript).

Perhaps something like this could work:

<html prefix="tal,foo,bar">
<head>
<title>Test Page</title>
</head>
<body>
<div tal-repeat="row array" tal-content="row/name">
Default Text!
</div>
</body>
</html>

Anyway, I hope you guys can understand where I'm coming from.

Luke
Received on Monday, 5 September 2011 13:07:39 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 5 September 2011 13:07:41 GMT