xsl-list
[Top] [All Lists]

RE: Xsl problem with output of repeated lines

2003-02-06 02:22:25
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



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