How to use a php variable with xsl?
How would I use an auto incremented php variable in XSL?
XSL?
function xslt_string($key){
$key++;
return isset($saved[$key]) ? $saved[$key] : ''开发者_如何学JAVA;
}
In XML?
<xsl:variable name="phpstring"
select="php:function('xslt_string', string('$saved[$key]'))" />
<xsl:value-of select="$post_param" />
XML NAME SPACE?
xmlns:php="/". (function on page that parses XSL)
I do it this way:
In your XSL:
<xsl:value-of select="$myVar"/>
In your PHP:
$proc = new XSLTProcessor();
//...
$proc->setParameter('', 'myVar', 'Your value here');
See XSLTProcessor::setParameter for more info.
精彩评论