RE: [xsl] XSL N-up like Reports

Subject: RE: [xsl] XSL N-up like Reports
From: Jarno.Elovirta@xxxxxxxxx
Date: Fri, 14 Feb 2003 09:41:34 +0200
Hi,

> I need to develop N-up reports using XSL for XML data like this. This
> includes paging.
> 
> Page 1 for provider "Z"
> ~~~~~~~~~~~~~~~~~~~~~~~
> 
> +---------+
> |  1 |  4 |
> |--------+
> |  2 |  5 |
> |---------+
> |  3 |  6 |
> +---------+
> 
> Page 2 (contd.) for provider "Z"
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> +---------+
> |  7 | 10 |
> |---------+
> |  8 | 11 |
> |---------+
> |  9 |    |
> +---------+
> 
> Page 2 for provider "Y"
> ~~~~~~~~~~~~~~~~~~~~~~~~
> +-----+
> |  12 |
> |-----+
> |  13 |
> +-----+

e.g.

<xsl:key name="provider" match="roaming" use="@provider" />

<xsl:template match="billing">
  <xsl:for-each select="roaming[generate-id(.) = generate-id(key('provider', @provider))]">
    <xsl:for-each select="key('provider', @provider)[position() mod 6 = 1]">
      <table>
        <caption>
          <xsl:text/>Page <xsl:value-of select="position()" />
          <xsl:if test="not(position() = 1)"> (contd.)</xsl:if>
          <xsl:text/> for provider "<xsl:value-of select="@provider" />"<xsl:text/>
        </caption>
        <tbody>
          <xsl:for-each select="self::* | following-sibling::roaming[position() &lt; 7][position() mod 2 = 1]">
            <tr>
              <td>
                <xsl:value-of select="." />
              </td>
              <xsl:if test="following-sibling::roaming[position() = 3]">
                <td>
                  <xsl:value-of select="following-sibling::roaming[position() = 3]" />
                </td>              
              </xsl:if>
            </tr>
          </xsl:for-each>
        </tbody>
      </table>
    </xsl:for-each>
  </xsl:for-each>
</xsl:template>

Hope this helps. Launch auto-documentation daemon and all that,

Jarno - SITD: Hurt (Club Version)

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


Current Thread