title: Using an XSLT param in an XPath expression
body: <p>When I use my XPath expression with a hardcoded variable, it gives me the right result:</p>
  
  <pre><code>    &lt;xsl:value-of select="count(//n-gram[@frequency &gt; 50])"/&gt;
  </code></pre>
  
  <p>But when I use a parameter of my template, it gives me a complete different result:</p>
  
  <pre><code>    &lt;xsl:value-of select="count(//n-gram[@frequency &gt; $freq])"/&gt;
  </code></pre>
  
  <p>Can somebody tell me what I'm doing wrong?</p>
  
  <p>Complete code as reference (I'm generating a XAML file with XSL):</p>
  
  <p>XML file:</p>
  
  <pre><code>&lt;n-grams&gt;
  &lt;n-gram frequency="3"&gt;r n u&lt;/n-gram&gt;
  &lt;n-gram frequency="1"&gt;o H e&lt;/n-gram&gt;
  &lt;n-gram frequency="2"&gt;r n t&lt;/n-gram&gt;
  &lt;n-gram frequency="2"&gt;N i c&lt;/n-gram&gt;
  &lt;n-gram frequency="2"&gt;a u l&lt;/n-gram&gt; ...
  </code></pre>
  
  <p>XSL templates:</p>
  
  <pre><code>    &lt;xsl:template name="fill-table"&gt;
      &lt;xsl:param name="freq"/&gt;
      &lt;xsl:param name="startRow"/&gt;
      &lt;xsl:param name="startCol"/&gt;
  
      &lt;xsl:call-template name="get-textblock"&gt;
          &lt;xsl:with-param name="row"&gt;
              &lt;xsl:value-of select="$startRow "/&gt;
          &lt;/xsl:with-param&gt;
          &lt;xsl:with-param name="column"&gt;
              &lt;xsl:value-of select="$startCol + 1"/&gt;
          &lt;/xsl:with-param&gt;
          &lt;xsl:with-param name="text"&gt;
              &lt;xsl:value-of select="count(//n-gram[@frequency &gt; $freq])"/&gt;
          &lt;/xsl:with-param&gt;
          &lt;xsl:with-param name="type"&gt;
              &lt;xsl:value-of select="'ValueText'"/&gt;
          &lt;/xsl:with-param&gt;
      &lt;/xsl:call-template&gt;
  
  &lt;/xsl:template&gt;
  
  
  &lt;xsl:template name="get-textblock"&gt;
      &lt;xsl:param name="row"/&gt;
      &lt;xsl:param name="column"/&gt;
      &lt;xsl:param name="text"/&gt;
      &lt;xsl:param name="type"/&gt;
      &lt;xsl:param name="colspan" select="1"/&gt;
      &lt;xsl:element name="TextBlock"&gt;
          &lt;xsl:attribute name="Grid.Column"&gt;
              &lt;xsl:value-of select="$column"/&gt;
          &lt;/xsl:attribute&gt;
          &lt;xsl:attribute name="Grid.Row"&gt;
              &lt;xsl:value-of select="$row"/&gt;
          &lt;/xsl:attribute&gt;
          &lt;xsl:attribute name="Style"&gt;
              &lt;xsl:value-of select="concat('{StaticResource ',$type,'}')"/&gt;
          &lt;/xsl:attribute&gt;
          &lt;xsl:attribute name="Grid.ColumnSpan"&gt;
              &lt;xsl:value-of select="$colspan"/&gt;
          &lt;/xsl:attribute&gt;
          &lt;xsl:value-of select="$text"/&gt;
      &lt;/xsl:element&gt;
  &lt;/xsl:template&gt;
  </code></pre>