Pythonic way of web-programming

poiboy bitbucket at safe-mail.net
Fri Apr 18 14:01:48 EDT 2003


> > Of course you can use template systems. But this is not always a good
> > economic decision.
>
> OK, but can't one use XML/XLST as a sole solution for the view?

I use XSLT [partially] for that reason; it is a general templating solution. 
The main reason I use XSLT however is because templating is the best (most 
relevant) excuse I have to keep another X specification in my repetoire.

The primary drawback to XSLT is having to fudge an XML document out of your
template variables before being able to transform them. If you're retrieving
data from a native XML source, great, otherwise you need to build an imaginary
tree and make sure it matches up with the paths in the template.  
 
Next, variable representation in the XSL template is likely to take up a whole
lot more room than a typical {{template_variable}}. Instead of standing out
nicely against a backdrop of HTML tags, the template variables in XSL have to
be searched for in small pools of xsl:for-each|value-of|copy-of|... tags and
select="/path/to/var" attributes (and if you've ever had trouble matching up
variable names in templates, you'll have a lot of fun with variable paths).

In the amount of time spent figuring out how to ensure unwanted text would
not appear without running my variable tree through a schema
(<xsl:template match="text()"/>), I could have implemented five other methods
to render my page (just guessing).

Neglecting the inherent joy of an education, I believe the cost of using XSLT
exceeds what benefits it may have (portability, and..) and is likely more
expensive than successive rewrites with other template systems.
 
Aloha, the poiboy




More information about the Python-list mailing list