PHP from XSLT

Christian Stocker’s checked in some code to PHP5 that’ll let you call any PHP function from within your XSLT. Not really portable, but there’s something nice about being able to generate ISO dates without passing them in as parameters to the transform.

Here’s Christian’s example:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

  xmlns:php="http://php.net/xsl" version='1.0'>

<xsl:template match="/">

<xsl:value-of select="php:function('date', 'r')"/>

</xsl:template>

</xsl:stylesheet>

More like this: , .