xsl:for-each-group starts a new group (a) at the first item in the sequence,
and (b) at each item in the sequence that matches the group-starting-with
pattern. You are wrapping both kinds of group in a gliederung1 element, when
you should only be wrapping the second kind of group. To distinguish the two
kinds of group you could (a) test whether the first item in the group
matches the conditions, or (b) simply treat the first group differently:
<xsl:when test="position()=1">.
Regards,
Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay
-----Original Message-----
From: Szabo, Patrick (LNG-VIE)
[mailto:patrick(_dot_)szabo(_at_)lexisnexis(_dot_)at]
Sent: 22 September 2009 08:33
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] weird grouping problem
Hi,
I use xslt 2.0 and saxon.
The problem is that it creates a <gliederung1> arround stuff
that it´s not supposed to...
I hope the source is not to unclear !
source:
<rumpf>
<absatz><starke-betonung>Das Urteil in der Rechtssache
Irland gegen Europäisches Parlament/Rat der
Europäische...</starkebetonung></absatz>
<zusammenfassung><starke-betonung>In seinem Urteil vom
10. Februa......</starke-betonung></zusammenfassung>
<absatz><starke-betonung>Hintergrund</starke-betonung></absatz>
<absatz>Unter dem Eindruck der Terroranschläge von New
York..absatz>
<absatz><starke-betonung>Die
EuGH-Entscheidung</starke-betonung></absatz>
<absatz>Einleitend (Rn 57 des Urteils) stellt der EuGH
klar, dass</absatz>
<absatz><betonung>„sich die von Irland erhobene
Klage allein auf die...</absatz>
<absatz>In weiterer Folge prüft der EuGH zunächst, ob
die Situation, die zum Erlass der...</absatz> ....
</rumpf>
desired output:
<rumpf>
<absatz><starke-betonung>Das Urteil in der Rechtssache
Irland gegen Europäisches Parlament/Rat der
Europäische...</starkebetonung></absatz>
<zusammenfassung><starke-betonung>In seinem Urteil vom
10. Februa......</starke-betonung></zusammenfassung>
<gliederung1>
<absatz><starke-betonung>Hintergrund</starke-betonung></absatz>
<absatz>Unter dem Eindruck der Terroranschläge
von New York..absatz>
</gliederung1>
<gliederung1>
<absatz><starke-betonung>Die
EuGH-Entscheidung</starke-betonung></absatz>
<absatz>Einleitend (Rn 57 des Urteils) stellt
der EuGH klar, dass</absatz>
<absatz><betonung>„sich die von Irland
erhobene Klage allein auf die...</absatz>
<absatz>In weiterer Folge prüft der EuGH
zunächst, ob die Situation, die zum Erlass der...</absatz> ....
</rumpf>
xslt:
<xsl:template match="rumpf">
<rumpf>
<xsl:for-each-group select="*"
group-starting-with="absatz[count(node() except
starke-betonung) = 0 and not(ancestor::zusammenfassung) and
not(following-sibling::zusammenfassung)]">
<gliederung1>
<xsl:apply-templates
select="current-group()"/>
</gliederung1>
</xsl:for-each-group>
</rumpf>
</xsl:template>
output:
<rumpf>
<gliederung>
<absatz><starke-betonung>Das Urteil in der
Rechtssache Irland gegen Europäisches Parlament/Rat der
Europäische...</starkebetonung></absatz>
<zusammenfassung><starke-betonung>In seinem
Urteil vom 10. Februa......</starke-betonung></zusammenfassung>
</gliederung1>
<gliederung1>
<absatz><starke-betonung>Hintergrund</starke-betonung></absatz>
<absatz>Unter dem Eindruck der Terroranschläge
von New York..absatz>
</gliederung1>
<gliederung1>
<absatz><starke-betonung>Die
EuGH-Entscheidung</starke-betonung></absatz>
<absatz>Einleitend (Rn 57 des Urteils) stellt
der EuGH klar, dass</absatz>
<absatz><betonung>„sich die von Irland
erhobene Klage allein auf die...</absatz>
<absatz>In weiterer Folge prüft der EuGH
zunächst, ob die Situation, die zum Erlass der...</absatz> ....
</rumpf>
regards
Patrick Szabo
XSLT-Entwickler
Tel.: +43 (1) 534 52 - 1573
Fax: +43 (1) 534 52 - 146
Patrick(_dot_)Szabo(_at_)lexisnexis(_dot_)at
LexisNexis Verlag ARD Orac GmbH & Co KG
Marxergasse 25, 1030 Wien
FN 8333f, Handelsgericht Wien
http://www.lexisnexis.at/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--