[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

AW: grouping problem

Subject: AW: grouping problem
From: "Szabo, Patrick \(LNG-VIE\)" <patrick.szabo@xxxxxxxxxxxxx>
Date: Fri, 2 Apr 2010 12:11:22 +0200
AW:  grouping problem
Thx a lot !
Works fine...

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: Martin Honnen [mailto:Martin.Honnen@xxxxxx]
Gesendet: Freitag, 02. April 2010 12:07
An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Betreff: Re:  grouping problem

Szabo, Patrick (LNG-VIE) wrote:

> I've got the following structure:
>
> <rechtliche-begruendung>
>     <ueberschrift>GrC<nde:</ueberschrift>
>     <absatz>I.</absatz>
>     <rz-zaehlung>1</rz-zaehlung>
>     <absatz>blabla</absatz>
>     <rz-zaehlung>2</rz-zaehlung>
>     <absatz>blabla</absatz>
>     <absatz>I.</absatz>
>     <rz-zaehlung>3</rz-zaehlung>
>     <absatz>blabla</absatz>
>     <absatz>blabla</absatz>
>     <rz-zaehlung>4</rz-zaehlung>
>     <absatz>blabla</absatz>
>     <absatz>II.</absatz>
>     <rz-zaehlung>5</rz-zaehlung>
>     <absatz>blabla</absatz>
> </rechtliche-begruendung>
>
> It should look like this after grouping:
>
> <rechtliche-begruendung>
>     <ueberschrift>GrC<nde:</ueberschrift>
>     <absatz>I.</absatz>
>     <randziffer>
> 	      <rz-zaehlung>1</rz-zaehlung>
> 	  	<absatz>blabla</absatz>
>     </randziffer>
>     <randziffer>
> 	      <rz-zaehlung>2</rz-zaehlung>
> 	    	<absatz>blabla</absatz>
>     </randziffer>
>     <absatz>I.</absatz>
>     <randziffer>
> 		<rz-zaehlung>3</rz-zaehlung>
>     		<absatz>blabla</absatz>
> 	      <absatz>blabla</absatz>
>     </randziffer>
>     <randziffer>
> 		<rz-zaehlung>4</rz-zaehlung>
> 	      <absatz>blabla</absatz>
>     </randziffer>
>     <absatz>II.</absatz>
>     <randziffer>
> 		<rz-zaehlung>5</rz-zaehlung>
> 	      <absatz>blabla</absatz>
>     </randziffer>
> </rechtliche-begruendung>
>
> So a group is starting with rz-zeahlung.
> The problem is that i don't want to have those <absatz> elements in the
groups that
> contain roman numbers...

The following should do:

<xsl:stylesheet
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   version="2.0">

   <xsl:output indent="yes"/>

   <xsl:template match="rechtliche-begruendung">
     <xsl:copy>
       <xsl:for-each-group select="*" group-adjacent="self::ueberschrift
or self::absatz[matches(., 'I+\.')]">
         <xsl:choose>
           <xsl:when test="current-grouping-key()">
             <xsl:copy-of select="current-group()"/>
           </xsl:when>
           <xsl:otherwise>
             <xsl:for-each-group select="current-group()"
group-starting-with="rz-zaehlung">
               <randziffer>
                 <xsl:copy-of select="current-group()"/>
               </randziffer>
             </xsl:for-each-group>
           </xsl:otherwise>
         </xsl:choose>
       </xsl:for-each-group>
     </xsl:copy>
   </xsl:template>

</xsl:stylesheet>

--

	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.