[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: newbie question...

Subject: Re: newbie question...
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 29 Nov 2001 11:38:29 +0000
Re:  newbie question...
Hi Terje,

> I got a simple table where I receive 4 variables from the xsql
> query:PNS (nom. size), POD (dia.(mm)), PWTH (Wall th.(mm)) and PSCH
> (Schedule). The result is presented on a web-page, but because we
> also want to print it out, we are not able to present more than 22
> records in each table. How do I tell the XSL to start printing a new
> table when it has reached 22 records?

You need to group using the position() of the ROW. You want the 1st,
23rd, 45th etc. ROW elements to generate a new table, so apply
templates only to those ROW elements:

  <xsl:apply-templates select="ROW[position() mod 22 = 1]" />

and have a template that matches ROW elements and creates the table
element. For the rows, it needs to look at that ROW element and its
following 22 siblings. I'd store these in a variable since you're
going to use them again and again to create each row. Then create the
cells in each row by iterating over $rows:

<xsl:template match="ROW">
  <table class="no" style="width:170mm;padding:1pt;" cellspacing="0"
         border="1">
    <xsl:variable name="rows"
      select=". | following-sibling::ROW[position() &lt; 22]" />
    <tr>
      <td class="b">Nom. Size(in)</td>
      <xsl:for-each select="$rows">
        <td class="lb"><xsl:value-of select="PNS" /></td>
      </xsl:for-each>
    </tr>
    <tr>
      <td class="t">dia.(mm)</td>
      <xsl:for-each select="$rows">
        <td class="lt"><xsl:value-of select="POD" /></td>
      </xsl:for-each>
    </tr>
    <tr>
      <td class="t">Wall th.(mm)</td>
      <xsl:for-each select="$rows">
        <td class="lt"><xsl:value-of select="PWTH" /></td>
      </xsl:for-each>
    </tr>
    <tr>
      <td class="t">Schedule</td>
      <xsl:for-each select="$rows">
        <td class="lt"><xsl:value-of select="PSCH" />&nbsp;</td>
      </xsl:for-each>
    </tr>
  </table>
</xsl:template>

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.