Blog of The SJG

Monday, September 04, 2006

XSLT shorthand for PHP

As I trudge toward Exhibition v2, I am taking the templating in an entirely new direction. Exhibition deals with XML, a lot of XML. As a direct consequence there is a fairly substantial amount of XSLT. Noticing that XSLT has a very straightforward syntax, I decided to write a little preprocessor to save my fingers some walking later on. Most commands boil down to "command" or "command required_argument" (required_argument usually being an XPath expression). So, that's exactly what I pruned it down to.
<@ for-each atom @>
versus
<xsl:for-each select="atom">
Check it out --

xsltemplate.phps

xsltemplate-test.tpl
xsltemplate-test.xml
xsltemplate-test.xsl
(examples stolen from W3Schools)

0 Comments:

Post a Comment

<< Home