From: Robert Hahn Date: 2003-02-16T12:04:55+09:00 Subject: Re: why html template systems never use new tags? Hey, Brian. >> I'm working on a templating system right now that works as an abstract >> class. It will scan a well-formed (in the XML sense) HTML document, >> and grab subtrees where the root of the subtree has a code attribute - > > I wrote a templating system once which used 'class', so for example you > could write > > My name is foo > > and it replaced 'foo' with the appropriate content. I just looked at > Amrita > and it seems to use exactly the same idea. It gives the side benefit of > being able to stylise the inserted content if you so wish. > > Is that what you were thinking about? Or is there some reason to use a > different attribute than 'class'? Yeah, pretty much. But I think there's a very important reason not to use class, or id (which I believe Amrita uses) - you're overloading the meaning of that attribute. In the case of class, that attribute is designed to be used with Cascading Style Sheets. In that light, then, what if a web designer designed a particular area of the page where several elements used the same value for class, and your templating system only wanted one particular one? The same general logic can be applied to the id tag, which is designed to be used when creating DHTML effects. The possibility of the programmer's wishes conflicting with the designers is, in my humble opinion, too great to risk designing a templating system around. All that said, it's a trivial process for anyone with a copy of the templating script to simply use a different attribute. I chose 'code' specifically because there is no tag for which there is a code attribute, and to ensure that all browsers are happy, I make sure I clean up after myself, removing either the attribute-value pair, or the whole subtree. -rh