Subject: RE: [xsl] weird grouping problem From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Tue, 22 Sep 2009 10:25:28 +0100 |
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 it4s not supposed to... > I hope the source is not to unclear ! > > source: > > <rumpf> > <absatz><starke-betonung>Das Urteil in der Rechtssache > Irland gegen Europdisches Parlament/Rat der > Europdische...</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 Terroranschldge 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 zundchst, ob > die Situation, die zum Erlass der...</absatz> .... > </rumpf> > > desired output: > > <rumpf> > <absatz><starke-betonung>Das Urteil in der Rechtssache > Irland gegen Europdisches Parlament/Rat der > Europdische...</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 Terroranschldge > 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 > zundchst, 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 Europdisches Parlament/Rat der > Europdische...</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 Terroranschldge > 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 > zundchst, 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] weird grouping problem, Szabo, Patrick \(LNG | Thread | AW: [xsl] weird grouping problem, Szabo, Patrick \(LNG |
[xsl] weird grouping problem, Szabo, Patrick \(LNG | Date | AW: [xsl] weird grouping problem, Szabo, Patrick \(LNG |
Month |