Re: [Request for feature] Problem with ClearSilver syntax

"David Jeske" <[email protected]> Sat, 30 Aug 2008 08:54:14 -0000
Newsgroups gmane.text.clearsilver.general
Message-ID <[email protected]>
-- =?UTF-8?Q?L=C3=A9o_Gillot-Lamure?= wrote:
> I don't know about standard HTML editors like Nvu because I'm using an
> XML editor, but my documents must be pure XML.

Clearsilver is capable of producing pure XML output documents, however, the
source documents are not xml compatible for a reason -- to allow arbitrary
templating it's necessary to put in data which is not xml compatible.

When I template XML with clearsilver, one of the most common things I do is use
template elements to output XML data itself, such as attribute names, and
element names. Doing this in a way that the source document is XML compatible
also is very cumbersome IMO. You can see this in xml-source html templating
languages. They have to make up funny versions of everything for when it
appears in an attribute. There are also limitations to what can be done, such
as inability to put expression and loops in to generate attribute names. I'm
just not a fan of this approach.

Aside from all this, clearsilver's control flow statements allow you to create
documents whose output is not linear with the source data. Certainly, you could
design your template statements to avoid this, but opening clearsilver
documents in an editor which is expecting to handle the output data isn't
always possible.

I also don't see how your proposals would work. XML does not allow arbitrary
characters in attribute data, so simply changing the delimiter to ()s will not
allow you to put clearsilver statements inside XML tags to programmatically
create attribute names. If what you want is a template language that does it's
work in an XML compatible way, there are others you could look at. I'd start
with XSLT. Though I recommend you try to use Clearsilver to generate your XML
without the expectation that you can load the source data in an xml editor.