我正在用 PHP 设置一个 xslt 参数,然后调用转换。我想在 XPath 表达式中使用参数值来获取正确的节点,但这似乎不起作用。我想这是可能的,我想我只是缺少语法。这里我有什么...
PHP:
$xslt->setParameter('','month','September');
XSL:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" />
<!-- Heres my param from the PHP -->
<xsl:param name="month" />
<!-- Here where I want it for grab the month node with the attribute name="September" but it doesn't work, gives me a compilation error -->
<xsl:template match="/root/year/month[@name = $month]">
<p>
<xsl:value-of select="$month" />
</p>
</xsl:template>