开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜