ssiedlerin268: <xsl:for-each-group ...> - Problem

Beitrag lesen

Hallo an alle! Ich habe folgendes Problem:

Hier ist meine XML-Datei [Ausschnitt]:

<doc>
 ....
<Daten>
<Zeile>
<Feld tabelle="N" DecPos="0" Digits="3" Name="FIRMENNUMMER" Type="S">...</Feld>
<Feld tabelle="N" DecPos="0" Digits="3" Name="NIEDERLASSUNG" Type="S">...</Feld>
<Feld tabelle="N" DecPos="0" Digits="1" Name="KZ DEB/KRED." Type="A">D</Feld>
<Feld tabelle="N" DecPos="0" Digits="9" Name="PERS.KONTENNUMMER" Type="S">....</Feld>
<Feld tabelle="N" DecPos="0" Digits="9" Name="SAMMELKONTO" Type="S">...</Feld>
<Feld tabelle="N" DecPos="0" Digits="30" Name="NAME 1" Type="A">....</Feld>
<Feld tabelle="N" DecPos="0" Digits="30" Name="NAME 2" Type="A"/>
<Feld tabelle="N" DecPos="0" Digits="30" Name="STRASSE" Type="A">...</Feld>
<Feld tabelle="N" DecPos="0" Digits="3" Name="LAND" Type="A">...</Feld>
<Feld tabelle="N" DecPos="0" Digits="6" Name="PLZ" Type="A">...</Feld>
<Feld tabelle="N" DecPos="0" Digits="30" Name="ORT" Type="A">...</Feld>
<Feld tabelle="N" DecPos="0" Digits="9" Name="VERBAND PK" Type="S">..</Feld>
...
</Zeile>
</Daten>
</doc>

Das Problem, welches ich nun in meiner XSL-Datei habe, ist folgendes: Ich möchte in einer Word-Datei eine Liste über "Offene Posten" verfassen. Diese enthält Zeile für Zeile die Inhalte des Tags 'Zeile' (mit Werten über Soll, Haben, Saldo, etc. pp - jedoch nur die, die tabelle="J" aufweisen). Fakt ist aber, dass es in der XML-Datei mehrere 'Zeile' gibt, bei denen die 'PERS.KONTENNUMMER' die gleiche ist (heißt also inhaltlich, dass eine 'PERS.KONTENNUMMER' natürlich mehrere Offene Posten, also auch 'Zeile'n haben kann). Diese sollen quasi alle unter einer Überschrift laufen, in der allgemeine Sachen wie z.B. Name, Firma, usw. stehen sollen. Meine XSL-Datei dazu sieht ausschnittsweise wie folgt aus:

....
<xsl:template match="Daten">
<xsl:for-each-group select="Zeile[Feld='K']" group-by="Feld/@Name='PERS.KONTENNUMMER'">
<w:p>
<w:pPr>
<w:tabs>
<w:tab w:val="left" w:pos="1500"/>
<w:tab w:val="left" w:pos="11000"/>
<w:tab w:val="left" w:pos="12000"/>
<w:tab w:val="left" w:pos="13050"/>
</w:tabs>
</w:pPr>
  <w:r>
  <w:t><xsl:value-of select="Feld[@Name='KZ DEB/KRED.']"/>xsl:text    </xsl:text><xsl:value-of select="Feld[@Name='PERS.KONTENNUMMER']"/></w:t>
  <w:tab/>
  <w:t> - <xsl:value-of select="Feld[@Name='NAME 1']"/>xsl:text </xsl:text><xsl:value-of select="Feld[@Name='NAME 2']"/>xsl:text </xsl:text><xsl:value-of select="Feld[@Name='PLZ']"/>xsl:text </xsl:text><xsl:value-of select="Feld[@Name='ORT']"/></w:t>
  <w:tab/>
  <w:t>Vertreter :</w:t>
  <w:tab/><w:tab/>
  <w:t>2. Zielgruppe:</w:t>
  </w:r>
  </w:p>
  <w:p>
<w:pPr>
<w:tabs>
<w:tab w:val="left" w:pos="3000"/>
<w:tab w:val="left" w:pos="6000"/>
</w:tabs>
</w:pPr>
  <w:r>
  <w:t>Ansprechpartner:</w:t>
  <w:tab/>
  <w:t>Telefon: </w:t>
  <w:tab/><w:tab/>
  <w:t>Telefax:</w:t>
  </w:r>
</w:p>
<xsl:for-each select="current-group()">
<w:p>
<w:pPr>
<w:tabs><w:tab w:val="left" w:pos="1500"/>
<w:tab w:val="left" w:pos="3000"/>
<w:tab w:val="left" w:pos="4500"/>
<w:tab w:val="left" w:pos="6000"/>
<w:tab w:val="left" w:pos="7500"/>
<w:tab w:val="left" w:pos="9000"/>
<w:tab w:val="left" w:pos="10500"/>
<w:tab w:val="left" w:pos="12000"/>
<w:tab w:val="left" w:pos="13050"/>
</w:tabs>
</w:pPr>
<w:r>
<xsl:for-each select="Feld[@tabelle='J']">
  <w:t><xsl:value-of select="."/></w:t><w:tab/>
   </xsl:for-each>
   </w:r>
   </w:p>
 </xsl:for-each>
   <w:p>
   <w:pPr>
<w:tabs><w:tab w:val="left" w:pos="1500"/>
<w:tab w:val="left" w:pos="3000"/>
<w:tab w:val="left" w:pos="4500"/>
<w:tab w:val="left" w:pos="6000"/>
<w:tab w:val="left" w:pos="7500"/>
<w:tab w:val="left" w:pos="9000"/>
<w:tab w:val="left" w:pos="10500"/>
<w:tab w:val="left" w:pos="12000"/>
<w:tab w:val="left" w:pos="13050"/>
</w:tabs>
</w:pPr>
<w:r>
  <w:tab/>
  <w:tab/>
  <w:t>722,00</w:t><w:tab/>
  <w:t>-722,00</w:t>
  <w:tab/>
  <w:t>0,00</w:t>
  <w:tab/>
  <w:t>*  Saldo Personenkontoxsl:text   </xsl:text><xsl:value-of select="Feld[@Name='PERS.KONTENNUMMER']"/></w:t>
  <w:br/>
  </w:r>
</w:p>
 </xsl:for-each-group>
...

Ich hoffe, dass das so ungefähr klar geworden ist, was ich erreichen will. Hat jemand eine Idee, weshalb er die ganze Sache nicht annimmt?