PHP and XSLTProcessor Misbehavior
Posted
by Aiden Bell
on Stack Overflow
See other posts from Stack Overflow
or by Aiden Bell
Published on 2010-05-29T18:29:01Z
Indexed on
2010/05/29
18:32 UTC
Read the original article
Hit count: 336
Hi all,
Simple question: Why is a PHP function called from an XSL Stylesheet just returning the last argument passed:
foo.xsl:
<xsl:template match="/">
<xsl:value-of select="php:function('date','c')" />
</xsl:template>
PHP:
...
$xsl = new XSLTProcessor();
$xsl->registerPHPFunctions();
$xsl->importStylesheet($fooStylesheet);
echo $xsl->transformToXML($myXML);
I Get the output
c
and if I call <xsl:value-of select="php:function('date')" />
I just get date
as my output. Seems strange to me.
Version info:
PHP 5.3.2
libxslt Version 1.1.26
libxslt compiled against libxml Version 2.7.6
EXSLT enabled
libexslt Version 1.1.26
© Stack Overflow or respective owner