1

我正在尝试将参数(通过 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>
4

1 回答 1

2

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

<xsl:value-of select="Bands/SensorBand[Name=$SensorBandName]/Frequencies/SensorBandFrequency[Name=$SensorBandFrequencyName]" />
于 2010-01-26T16:15:56.233 回答