tags:

views:

108

answers:

2

Hi, I'm trying to pass parameters (through c#) to the following XSLT to build a query with multiple filters but it is not working. What am I doing wrong and what is the correct way to do this?

(The filter works with hard-coded values and the parameter values are getting through to the XSLT)

Thanks!

<?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  A: 

Don't quote the variable/parameter names!

<xsl:value-of select="Bands/SensorBand[Name=$SensorBandName]/Frequencies/SensorBandFrequency[Name=$SensorBandFrequencyName]" />
Lucero
Thanks! That worked!
Gerard
You're welcome. However, you could have accepted it as answer, being that I posted it a minute earlier than Rubens and that it is the same otherwise... ;)
Lucero
I do agree, so I gave +1 to you
Rubens Farias
Thanks Rubens, I appreciate it.
Lucero
@Gerard - FYI - you can unselect an answer by clicking again and then select a different answer.
Mads Hansen
+2  A: 

You should to remove that single quotes:

<xsl:value-of select="Bands/SensorBand[Name=$SensorBandName]/Frequencies/SensorBandFrequency[Name=$SensorBandFrequencyName]" />
Rubens Farias