xsl-list
[Top] [All Lists]

RE: XSL N-up like Reports

2003-02-14 00:41:34
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



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