exslt_own_function.xsl:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:bxf="http://bitflux.org/functions"
xmlns:func="http://exslt.org/functions"
extension-element-prefixes="func"
>
<func:function name="bxf:max">
<xsl:param name="a"/>
<xsl:param name="b" select="0"/>
<xsl:choose>
<xsl:when test="$a > $b">
<func:result select="$a"/>
</xsl:when>
<xsl:otherwise>
<func:result select="$b"/>
</xsl:otherwise>
</xsl:choose>
</func:function>
<xsl:template match="/">
<xsl:value-of select="bxf:max(2,3)"/>
<xsl:value-of select="bxf:max(2,1)"/>
<xsl:value-of select="bxf:max(1)"/>
<xsl:value-of select="bxf:max(-1)"/>
</xsl:template>
</xsl:stylesheet>
Calling PHP functions from XSLT (evil...)
© copyright 2004 Bitflux GmbH