Hayko Riemenschneider wrote:
> Hi!
>
> I've got me an XSL tranformation stylesheet for my XML file. In the
> XSL file I now wish to use PHP to do some scripting. So I thought
> I'll use the PIs like this:
>
> <xsl:processing-instruction name="php">
> echo $hello;
> </xsl:processing-instruction>
>
> But this just gets ignored. No error, just not processed. Do I need to
> enable something (in PHP, Apache) to use these PIs?
>
> This is on an Apache/2.0.49 (Win32) PHP/4.3.6 Server.
>
A processing-instruction does not execute the code within. The following
example:
<xsl:template match="/">
<xsl:processing-instruction name="foo">
<xsl:text>type="txt/xml"</xsl:text>
</xsl:processing-instruction>
</xsl:template>
Only generates the following tag in the output:
<?foo type="txt/xml"?>
Which doesn't do anything.
If you want to use PHP functions in your XSLT stylesheet, you can do this
through the document() function.
See the examples in the following manual page:
http://nl2.php.net/manual/en/functio...e-handlers.php
And yes, this requires the parsing of the stylesheet to be done by PHP's
XSLT extension...
JW