title: Table with fixed number of rows (xslt, sql)
body: <p>I have problem with setting fixed number of rows in my table.
  I created table with similar code with this one:</p>
  
  <pre><code>&lt;xsl:for-each select="DBData/tabulka1/Row[position() &amp;lt; 14]"&gt;
        &lt;tr&gt;
               &lt;td&gt;&lt;xsl:value-of select="ODESILATEL"/&gt;&lt;/td&gt;
               &lt;td&gt;&lt;xsl:value-of select="PREDMET"/&gt;&lt;/td&gt;
               &lt;td align="right" class="sOkrajem"&gt;&lt;/td&gt;
        &lt;/tr&gt;
  &lt;/xsl:for-each&gt;
  </code></pre>
  
  <p>And I need to fix number of rows to 15, even if I get a few records. </p>
  
  <p>To example, if I get only 13 rows from database, so the two left rows will be empty, but will be there. For better understand, here is image:
  <a href="http://imageshack.us/photo/my-images/692/tabulkar.png/" rel="nofollow">http://imageshack.us/photo/my-images/692/tabulkar.png/</a></p>
  
  <p>If will be neccesary, I can edit my SQL code.</p>
  
  <p>Thanks for all advice. And sorry for representation of my problem.</p>
  
  <p>edit. more extensive example of my code:</p>
  
  <p>I have problem with setting fixed number of rows in my table.
  I created table with similar code with this one:</p>
  
  <pre><code>&lt;xsl:for-each select="DBData/tabulka1/Row[position() &amp;lt; 14]"&gt;
        &lt;tr&gt;
               &lt;td&gt;&lt;xsl:value-of select="ODESILATEL"/&gt;&lt;/td&gt;
               &lt;td&gt;&lt;xsl:value-of select="PREDMET"/&gt;&lt;/td&gt;
               &lt;td align="right" class="sOkrajem"&gt;&lt;/td&gt;
        &lt;/tr&gt;
  &lt;/xsl:for-each&gt;
  </code></pre>
  
  <p>And I need to fix number of rows to 15, even if I get a few records. </p>
  
  <p>To example, if I get only 13 rows from database, so the two left rows will be empty, but will be there. For better understand, here is image:
  <a href="http://imageshack.us/photo/my-images/692/tabulkar.png/" rel="nofollow">http://imageshack.us/photo/my-images/692/tabulkar.png/</a></p>
  
  <p>If will be neccesary, I can edit my SQL code.</p>
  
  <p>Thanks for all advice. And sorry for representation of my problem.</p>
  
  <p>edit. more extensive example of my latest use of code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="windows-1250"?&gt;
  
  &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
    &lt;xsl:param name="RolesPath" select="'%RolesPath%'"/&gt;
    &lt;xsl:decimal-format decimal-separator=","
                        grouping-separator="&amp;#160;"/&gt;
  
    &lt;xsl:include href="%RolesPath%\_foot.xsl" /&gt;
    &lt;xsl:template match="/"&gt;
      &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs"&gt;
  
  
        &lt;head&gt;
          &lt;meta name="lang" content="cs" /&gt;
          &lt;meta http-equiv="Content-Type" content="text/xml; charset=windows-1250" /&gt;
          &lt;meta name="copyright" content="© 2009-2010 Flores" /&gt;
          &lt;link rel="stylesheet" type="text/css" href="style.css" /&gt;
  
        &lt;/head&gt;
        &lt;body class ="teloBezObrazku"&gt;
          &lt;table width="95%" class="tabulka"&gt;
            &lt;th colspan="3" class="nadpis"&gt;Vzkazy&lt;/th&gt;
            &lt;xsl:variable name="numRows" select="15" /&gt;
            &lt;xsl:variable name="rows" select="DBData/tabulka1/Row" /&gt;
            &lt;xsl:apply-templates select="$rows[position() &amp;lt;= $numRows]" /&gt;
            &lt;xsl:call-template name="AddRows"&gt;
              &lt;xsl:with-param name="numRows" select="$numRows - count($rows)" /&gt;
            &lt;/xsl:call-template&gt;
          &lt;/table&gt;
          &lt;span style="position: absolute; bottom: 10;"&gt;
            &amp;#160;&amp;#160;&lt;a href="abrasite:A4NHDUKJESG4PJAVPQJFMAE2PS"&gt;Otevřít vše...&lt;/a&gt;&lt;b class="cara"&gt;|&lt;/b&gt;&amp;#160;
            &lt;a href="abrasite:A4NHDUKJESG4PJAVPQJFMAE2PS,0,DoNewOnly"&gt;Nový...&lt;/a&gt;
          &lt;/span&gt;
          &lt;xsl:call-template name="footer"&gt;
            &lt;xsl:with-param name="RolesPath" select="'%RolesPath%'"/&gt;
          &lt;/xsl:call-template&gt;
          &lt;/foot&gt;
        &lt;/html&gt;
    &lt;/xsl:template&gt;
    &lt;!-- Separate templates --&gt;
    &lt;xsl:template name="TableRow" match="tabulka1/Row"&gt;
      &lt;tr&gt;
        &lt;td&gt;
          &lt;xsl:value-of select="self::Row/ODESILATEL"/&gt;
        &lt;/td&gt;
        &lt;td&gt;
          &lt;xsl:value-of select="self::Row/PREDMET"/&gt;
        &lt;/td&gt;
        &lt;td align="right" class="sOkrajem"&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/xsl:template&gt;
  
    &lt;xsl:template name="AddRows"&gt;
      &lt;xsl:param name="numRows" /&gt;
      &lt;xsl:if test="$numRows &gt; 0"&gt;
        &lt;xsl:call-template name="TableRow" /&gt;
  
        &lt;xsl:call-template name="AddRows"&gt;
          &lt;xsl:with-param name="numRows" select="$numRows - 1" /&gt;
        &lt;/xsl:call-template&gt;
      &lt;/xsl:if&gt;
    &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>edit. First line probably getting error.</p>
  
  <pre><code>&lt;xsl:template name="tabulka1 | tabulka1/Row" mode="row"&gt;
    &lt;tr onmouseover="className='seda'" onmouseout="className='bila'" title="{OBSAH}" style="cursor:hand" xmlns="http://www.w3.org/1999/xhtml"&gt;
      &lt;a href="abrasite:A4NHDUKJESG4PJAVPQJFMAE2PS,0,DoShow;{ID}"&gt;
        &lt;xsl:choose&gt;
          &lt;xsl:when test = "PRECTENO='N'"&gt;
            &lt;td align="left" class="sOkrajem"&gt;&lt;b&gt;&lt;xsl:value-of select="self::Row/ODESILATEL"/&gt;&lt;/b&gt;&lt;/td&gt;
              &lt;td align="left" class="sOkrajem"&gt;&lt;b&gt;&lt;xsl:value-of select="self::Row/PREDMET"/&gt;&lt;/b&gt;&lt;/td&gt;
              &lt;td align="right" class="sOkrajem"&gt;
                &lt;b&gt;&lt;xsl:value-of select="self::Row/DATUM"/&gt;&amp;#160;&lt;xsl:value-of select="self::Row/HODINY"/&gt;&lt;xsl:value-of select="self::Row/MINUTY"/&gt;&lt;/b&gt;
              &lt;/td&gt;
            &lt;/xsl:when&gt;
            &lt;xsl:otherwise&gt;
              &lt;td align="left" class="sOkrajem"&gt;&lt;xsl:value-of select="self::Row/ODESILATEL"/&gt;&lt;/td&gt;
              &lt;td align="left" class="sOkrajem"&gt;&lt;xsl:value-of select="self::Row/PREDMET"/&gt;&lt;/td&gt;
              &lt;td align="right" class="sOkrajem"&gt;
                &lt;xsl:value-of select="self::Row/DATUM"/&gt;&amp;#160;&lt;xsl:value-of select="self::Row/HODINY"/&gt;&lt;xsl:value-of select="self::Row/MINUTY"/&gt;
              &lt;/td&gt;
          &lt;/xsl:otherwise&gt;
        &lt;/xsl:choose&gt;
      &lt;/a&gt;
    &lt;/tr&gt;
  &lt;/xsl:template&gt;
  </code></pre>