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>

Possibly Related posts (machine generated):

  1. XSLT Google Directory Category Hack
  2. The Parameter Envelope Pattern
  3. Emulating AxKit/Cocoon 1.0 in PHP with DOMXML
  4. Structured Writing, Structured Search
  5. Savant3: Simple Templating for PHP5

More like this: , .

blog comments powered by Disqus