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

RE: Xsl problem with output of repeated lines

Subject: RE: Xsl problem with output of repeated lines
From: Jarno.Elovirta@xxxxxxxxx
Date: Thu, 6 Feb 2003 11:22:25 +0200
xsl value of repeat
Hi,

> In this xml file the value of HSN appears once per 
> Zelle,Alternative but 
> the values of typ, nr and fix_knz appears more than once. Now 
> I want to 
> print out one line with value of HSN and several lines with values of 
> typ etc.
> 
> My output example:
> 
> Zelle                 Alternative      values
> ----------- ---------------- --------------
> BXB0000C      test             2                    (one line 
> for value 
> of HSN)
> BXB0000C      test             b   1   wunsch       (three lines for 
> values typ, nr, fix_knz)
> BXB0000C      test             t   33  fest
> BXB0000C      test             td  22  frei
> BXB0001A      xy              3                    (next HSN value)
> ....                                                          
>     (next 
> lines for values typ, nr, fix_knz)
> ....
> 
> Can somebody help me to solve the problem? I tried with parameters to 
> remember the values of Zelle and Alternative but it does not work :-(
> Many thanks for your help,

It's a grouping problemn, see Jeni's pages <http://jenitennison.com/xslt/grouping> for more info.

<xsl:strip-space elements="*" />

<xsl:key name="zelle" match="Zellgruppe/Zelle" use="Zelle" />

<xsl:template match="Zellgruppe">
  <table>
    <thead>
      <tr>
        <th>Zelle</th>
        <th>Alternative</th>
        <th colspan="3">values</th>
      </tr>
    </thead>
    <tbody>
      <xsl:for-each select="Zelle[generate-id(.) = generate-id(key('zelle', Zelle))]">
        <tr>
          <td>
            <xsl:value-of select="Zelle" />
          </td>
          <td>
            <xsl:value-of select="Alternative" />
          </td>
          <td colspan="3">
            <xsl:value-of select="HSN" />
          </td>          
        </tr>
        <xsl:for-each select="key('zelle', Zelle)">
          <tr>
            <td>
              <xsl:value-of select="Zelle" />
            </td>
            <td>
              <xsl:value-of select="Alternative" />
            </td>
            <td>
              <xsl:value-of select="typ" />
            </td>        
            <td>
              <xsl:value-of select="nr" />
            </td>          
            <td>
              <xsl:value-of select="fix_knz" />
            </td>                      
          </tr>          
        </xsl:for-each>
      </xsl:for-each>
    </tbody>
  </table>
</xsl:template>

Cheers,

Jarno - Claire Voyant: Twenty-Four Years

 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.