AW: [xsl] weird grouping problem

Subject: AW: [xsl] weird grouping problem
From: "Szabo, Patrick \(LNG-VIE\)" <patrick.szabo@xxxxxxxxxxxxx>
Date: Tue, 22 Sep 2009 11:27:52 +0200
thx a lot !

regards


Patrick Szabo
 XSLT-Entwickler

Tel.: +43 (1) 534 52 - 1573
Fax: +43 (1) 534 52 - 146

Patrick.Szabo@xxxxxxxxxxxxx

LexisNexis Verlag ARD Orac GmbH & Co KG
Marxergasse 25, 1030 Wien
FN 8333f, Handelsgericht Wien
http://www.lexisnexis.at/

-----UrsprC<ngliche Nachricht-----

Von: Michael Kay [mailto:mike@xxxxxxxxxxxx]
Gesendet: Dienstag, 22. September 2009 11:25
An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Betreff: RE: [xsl] weird grouping problem


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.szabo@xxxxxxxxxxxxx]
> Sent: 22 September 2009 08:33
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] weird grouping problem
>
> Hi,
>
> I use xslt 2.0 and saxon.
> The problem is that it creates a <gliederung1> arround stuff
> that itB4s not supposed to...
> I hope the source is not to unclear !
>
> source:
>
> <rumpf>
> 	<absatz><starke-betonung>Das Urteil in der Rechtssache
> Irland gegen EuropC$isches Parlament/Rat der
> EuropC$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 TerroranschlC$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>&#8222;sich die von Irland erhobene
> Klage allein auf die...</absatz>
> 	<absatz>In weiterer Folge prC<ft der EuGH zunC$chst, ob
> die Situation, die zum Erlass der...</absatz> ....
> </rumpf>
>
> desired output:
>
> <rumpf>
> 	<absatz><starke-betonung>Das Urteil in der Rechtssache
> Irland gegen EuropC$isches Parlament/Rat der
> EuropC$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 TerroranschlC$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>&#8222;sich die von Irland
> erhobene Klage allein auf die...</absatz>
> 		<absatz>In weiterer Folge prC<ft der EuGH
> zunC$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 EuropC$isches Parlament/Rat der
> EuropC$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 TerroranschlC$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>&#8222;sich die von Irland
> erhobene Klage allein auf die...</absatz>
> 		<absatz>In weiterer Folge prC<ft der EuGH
> zunC$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.Szabo@xxxxxxxxxxxxx
>
> LexisNexis Verlag ARD Orac GmbH & Co KG
> Marxergasse 25, 1030 Wien
> FN 8333f, Handelsgericht Wien
> http://www.lexisnexis.at/

Current Thread