Hi!
Access to the PHP Variables from XSL:
----- example of the XSTL code ------
....
<xsl:value-of select="document('php_var://HTTP_ACCEPT_LANGUAGE')/value"/>
....
--------------------------------------------
----- PHP code --------
/*****************************************************************
PHP_Var SchemeHandler
*****************************************************************/
/* getAll: open the URI and return the whole string
scheme = URI scheme (e.g. "http")
rest = the rest of the URI (without colon)
the document is returned in a handler-allocated buffer
byteCount holds the byte count on return
return *buffer = NULL if not processed
*/
function XSLTPHPSchemeHandlerGetAll( $processor, $scheme, $rest,
&$buffer) {
if( $scheme == 'php_var') {
$varname = substr (strrchr ($rest, "/"), 1);
global $$varname;
$buffer = '<?xml version="1.0"
encoding="UTF-8"?><value>'.($$varname).'</value>';
}
}
$SchemeHandlerArray = array();
$SchemeHandlerArray[ "getAll" ] = "XSLTPHPSchemeHandlerGetAll";
/* only 'getAll' handler is implemented in the Sablotron XSLT PHP
extension (PHP V4.0.5) */
$xslt_parcer = xslt_create();
xslt_set_scheme_handler( $xslt_parcer, $SchemeHandlerArray );
....
xslt_run( $xslt_parcer, ...
--------------------------
With best regards,
Alexander Veremyev.
> -----Original Message-----
> From: John Risby [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 18, 2001 8:28 PM
> To: Sablotron Mailing List
> Subject: [Sab] including php in xsl
>
[...]
>
> <a><xsl:attribute name="href"><script language="php">echo
> $varname;</script></xsl:attribute></a>
>
> it doesn't ? any idea why.
>
> I need to do this (or similar) because i cannot put the php
> variables i need
> into the xml. The php classes that write out the xml are to be generic and
> the additional variables are to be added at will.
>
[...]