xsl-list
[Top] [All Lists]

RE: Incrementing a Global variable

2003-08-26 22:51:47
Hi,

Also i have Isolated Problem Page from  Actual output
which contains multiple pdf pages. This part is
conditionaly separated from other pdf pages ( which
are
further grouped using Muenchian Method)

Could you integrage this approach to your stylesheets?

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:output method="html"/>
  <xsl:variable name="varRowLimit" select="15"/>
  <xsl:variable name="Student_Count" select="count(Students/Student)"/>
  <xsl:template match="Students">
    <title></title>
    <table>
      <tbody>
        <xsl:apply-templates select="Student[1]"/>
      </tbody>
    </table>
  </xsl:template>
  <xsl:template match="Student" name="Student">
    <xsl:param name="counter" select="1"/>
    <tr>
      <td>
        <xsl:value-of select="$counter"/>
      </td>
      <td>
        <xsl:value-of select="Name"/>
      </td>
      <td>
        <xsl:value-of select="TOption"/>
      </td>
    </tr>
    <xsl:variable name="next" select="following-sibling::Student[1]"/>
    <xsl:choose>
      <xsl:when test="not($next)">
        <tr>
          <td>
            <xsl:value-of select="$counter + 1"/>
          </td>
          <td>
            <xsl:text/>Total = <xsl:value-of select="$Student_Count"/>
          </td>
          <td></td>
        </tr>
        <xsl:call-template name="empty">
          <xsl:with-param name="counter" select="$counter + 2"/>
          <xsl:with-param name="left" select="$varRowLimit - $Student_Count - 
3"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:when test="TOption = $next/TOption">
        <xsl:apply-templates select="$next">
          <xsl:with-param name="counter" select="$counter + 1"/>
        </xsl:apply-templates>
      </xsl:when>
      <xsl:otherwise>
        <xsl:call-template name="empty">
          <xsl:with-param name="counter" select="$counter + 1"/>
        </xsl:call-template>
        <xsl:apply-templates select="$next">
          <xsl:with-param name="counter" select="$counter + 2"/>
        </xsl:apply-templates>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <xsl:template name="empty">
    <xsl:param name="counter" select="0"/>
    <xsl:param name="left" select="1"/>
    <xsl:if test="$left">
      <tr>
        <td>
          <xsl:value-of select="$counter"/>
        </td>
        <td></td>
        <td></td>
      </tr>
      <xsl:call-template name="empty">
        <xsl:with-param name="counter" select="$counter + 1"/>
        <xsl:with-param name="left" select="$left - 1"/>
      </xsl:call-template>
    </xsl:if>
  </xsl:template>
</xsl:stylesheet>

Cheers,

Jarno - Feindflug: Größenwahn (Life Cried Remix)

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>