xsl:param和多个过滤器

时间:2010-01-26 16:13:22

标签: xslt param

我正在尝试将参数(通过c#)传递给以下XSLT,以构建具有多个过滤器的查询,但它无法正常工作。我做错了什么,做到这一点的正确方法是什么?

(过滤器使用硬编码值,参数值通过XSLT)

谢谢!

<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
  <xsl:output method="html" />
  <xsl:param name="SensorBandName" />
  <xsl:param name="SensorBandFrequencyName" />
  <xsl:template match="Sensor">
    <html>
      <head>
        <title></title>
      </head>
      <body>
        <p>
          <xsl:value-of select="Bands/SensorBand[Name='$SensorBandName']/Frequencies/SensorBandFrequency[Name='$SensorBandFrequencyName']" />
        </p>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>

1 个答案:

答案 0 :(得分:2)

不要引用变量/参数名称!

<xsl:value-of select="Bands/SensorBand[Name=$SensorBandName]/Frequencies/SensorBandFrequency[Name=$SensorBandFrequencyName]" />
相关问题