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

RE: not standart table in stylesheet, need advise

Subject: RE: not standart table in stylesheet, need advise
From: Americo Albuquerque <aalbuquerque@xxxxxxxxxxxxxxxx>
Date: Fri, 28 Feb 2003 15:56:42 -0000
tables in stylesheet

> -----Mensagem original-----
> De: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] Em nome de 
> Andrey Solonchuk
> Enviada: quinta-feira, 27 de Fevereiro de 2003 16:19
> Para: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Assunto:  not standart table in stylesheet, need advise
> 
(...)
> 
> I need table with the next columns
> 
> ------------------------------------
> | @flag = 1         |      @flag=2 |
> |code|sname|sum|date|code|sname|sum|
(...)

You could use apply-templates and modes.
This is a simple variation of your template. It creates one table for
@flag=1 and another for @flag=2. the bottom is filled with blank to
unsure that the two tables have the same number of rows.

 <!-- main template -->
 <xsl:template match="root">
 <xsl:variable name="flag1" select="list[@flag=2]"/>
 <xsl:variable name="flag2" select="list[@flag=1]"/>
 <html>
  <head></head>
  <body>
  <big>title</big>
  <table>
   <tr>
    <!-- here we create the first table -->
    <td valign="top"><table>
     <tr>
      <th>codePMT</th>
      <th>sName</th>
      <th>summa</th>
      <th>date</th>
     </tr>
     <xsl:apply-templates select="$flag1" mode="flag1"/>
     <!-- and fill what left with blanks -->
     <xsl:apply-templates select="$flag1[position() &lt; (count($flag2)
- count($flag1) + 1)]" mode="fill"/>
     <tr>
      <th></th>
      <th></th>
      <th><xsl:value-of
select="format-number(sum($flag1/sum-amt),'.00')"/></th>
      <th><xsl:value-of select="sum($flag1/days)"/></th>
     </tr>
    </table></td>
    <!-- here we create the second table -->
    <td valign="top"><table>
     <tr>
      <th>codePMT</th>
      <th>sName</th>
      <th>summa</th>
     </tr>
     <xsl:apply-templates select="$flag2" mode="flag2"/>
     <!-- and fill what left with blanks -->
     <xsl:apply-templates select="$flag2[position() &lt; (count($flag1)
- count($flag2) + 1)]" mode="fill"/>
     <tr>
      <th></th>
      <th></th>
      <th><xsl:value-of
select="format-number(sum($flag2/sum-amt),'.00')"/></th>
     </tr>
    </table></td>
   </tr>
  </table>
  </body>
 </html>
 </xsl:template>
 
 <!-- mode for the first table -->
 <xsl:template match="list" mode="flag1">
  <tr>
   <th><xsl:value-of select="code-pMT"/></th>
   <th><xsl:value-of select="sname"/></th>
   <th><xsl:value-of select="sum-amt"/></th>
   <th><xsl:value-of select="days"/></th>
  </tr>
 </xsl:template>
 
 <!-- mode for the second table -->
 <xsl:template match="list" mode="flag2">
  <tr>
   <th><xsl:value-of select="code-pMT"/></th>
   <th><xsl:value-of select="sname"/></th>
   <th><xsl:value-of select="sum-amt"/></th>
  </tr>
 </xsl:template>
 
 <!-- filling mode -->
 <xsl:template match="list" mode="fill">
  <tr>
   <th>&#160;</th>
  </tr>
 </xsl:template>


 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.