Login / Status
developer.Resource
Home . Development . Articles . TypoScript vs XSLT
Sponsors
hosted by punkt.deTYPO3 and Open Source MagazineAOE Media

TypoScript vs XSLT

Lately I was asked a few questions about my opinion on the standardized template technology XSLT/XML. I compiled the essence of my answer into this little article:


Are there reasons why you have chosen <i>not</i> to employ XSL?

First of all, I don't know the technology. Especially i did not know about it when I needed something like TypoScript. As far as I remember the XSL proposals were published in November 1999 which is a little later than TypoScript was born. Anyways I wouldn't have considered a brand new technology until it was more stable and had proved to be useful and supported. At that time there certainly were no significant XSL(T) processors.

But TypoScript is also a concept that fits the PHP/TYPO3 configuration very well although I admit that it has been taken too far in certain areas. TypoScript is basically a large object-like structure of information which can be set from text-files (DB-records...) and the TYPO3 default PHP front-end code just reacts to the settings in TypoScript.

TypoScript was not destined to be a procedural language and it is not today! I prefer to compare it to Windows registration database which - to my knowledge - is a similar bunch of hierarchical configuration.

XSLT vs TypoScript - my comparison

Using XSLT for rendering HTML in TYPO3?

In order for this to make sense, there would need to be a "Typo3ML" XML schema which an XSLT stylesheet is able to process into something useful.

The first problem I see here is, how much information should that XML-file contain? Only the information of the TYPO3 page? Or the whole MySQL database? It's a very inconvenient problem that XSL stylesheets needs all information in the XML file and further that todays XSL processors are able to process only fully loaded XML documents. So basically XML is a poor solution when a SQL database is so much more useful (and scalable) here. And everything is in the SQL database already.

The second problem is that it seems to be awkward to dynamically transform SQL data into XML data which are processed by an XSLT processor into HTML while it would be so much easier to output the HTML directly from TypoScript!

So how can XSLT fit into the TypoScript world?

If you go for XSLT you would still need TypoScript for at least the most basic configuration in order to generate the XML-document needed! This would be a task equalent to making WAP pages with TYPO3.

So for rendering ordinary HTML, I would say XSLT is a too clumsy process. Too much work and too much overhead.

But for rendering a PDF version of a page, XSLT would probably be the most suitable solution, if some XSLT stylesheet for such a conversion is readily available! That would be a cool trick; Making some XML-output (by TypoScript/PHP of course) which conforms with the input specifications of the XSLT-stylesheet which then outputs a nice PDF document! Certainly a good solution. Especially you could imaging programming the XSLT stylesheet with some graphical application like InDesign or whatever package may support development of templates (Framemaker?). Would be a great way to produce printable PDF catalogs from the MySQL database content in TYPO3.


Are you planning XSL support for future releases?

XSL support is as far as I see a question about making XML output from TypoScript/PHP which fits an XSLT stylesheet.

So... no. Not for HTML. But if anybody could point out a useful XSLT for which to write XML output via TS/PHP, surely I would be interested. Especially a way to convert web-data to print-data (eg. PDF).


Please correct me if I have missed some things or if I've incorrectly described how XML/XSLT is working. I had to read a little information about it before I could say anything (hopefully) competent on the matter.

 

The original conversation was with Joachim Peer.

 

- kasper