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

Grouping similar elements and putting out information

Subject: Grouping similar elements and putting out information about the first and the last member
From: "Huditsch Roman" <Roman.Huditsch@xxxxxxxxxxxxx>
Date: Thu, 24 Feb 2005 09:25:13 +0100
current group xsl
Hi group,

I am once again catched in a grouping problem.
I have a structure like this one:


<norm xmlns="http://www.lexisnexis.at/schema/norm" id="dv_eheg">
	...
	<jur_block id="p13" v_ref="v0" v_marker="dazu">
		<zaehlung zaehlungsart="Paragraf">13</zaehlung>
		<absatz>Das Verbot der Doppelehe (' 8 des Ehegesetzes) steht einer
Wiederholung der Eheschlie_ung nicht entgegen, wenn die Ehegatten Zweifel an
der G|ltigkeit oder an dem Fortbestand ihrer Ehe hegen.</absatz>
	</jur_block>
	<jur_block id="p14_1" v_ref="v0" v_marker="dazu">
		<zaehlung zaehlungsart="Paragraf">14</zaehlung>
		<absatz>[Text ist nicht vorhanden.]</absatz>
		<anmerkung>(aufgehoben, StGBl 1945/31 und BGBl 1976/331)</anmerkung>
	</jur_block>
	<jur_block id="p15_1" v_ref="v0" v_marker="dazu">
		<zaehlung zaehlungsart="Paragraf">15</zaehlung>
		<absatz>[Text ist nicht vorhanden.]</absatz>
		<anmerkung>(aufgehoben, StGBl 1945/31 und BGBl 1976/331)</anmerkung>
	</jur_block>
	<jur_block id="p16" v_ref="v0" v_marker="dazu">
		<zaehlung zaehlungsart="Paragraf">16</zaehlung>
		<absatz>Soweit auf die vermvgensrechtlichen Beziehungen der Ehegatten aus
einer f|r nichtig erkldrten Ehe die im Falle der Scheidung geltenden
Vorschriften entsprechende Anwendung finden (' 31 Abs. 1 des Ehegesetzes),
kann im Falle des <version v_ref="v8"/> ' 69 Abs. 3 des Ehegesetzes jeder
Ehegatte Unterhalt ohne R|cksicht darauf verlangen, wer die Nichtigkeitsklage
erhoben hatte.</absatz>
	</jur_block>
	...
</norm>

For each <jur_block> which has an <anmerkung> starting with "(aufgehoben" I
need to put out the <zaehlung> of the first preceding <jur_block> element with
<absatz>[Text ist nicht vorhanden.]</absatz> and the last following
<jur_block>.

For example, the stylesheet should produce a string like "13 bis 15
(aufgehoben, StGBl 1945/31 und BGBl 1976/331)".

I tried to solve this issue with <xsl:for-each-group> but I was unable to get
the <zaehlung> of the first and last group member....

Here is my XSLT code snippet:

<xsl:template match="ln:anmerkung">
	<xsl:variable name="val" select="."/>
	<xsl:choose>
		<xsl:when test="starts-with(., '(aufgehoben') and
preceding-sibling::ln:absatz[.='[Text ist nicht vorhanden.]']">
			<xsl:for-each-group select="../../ln:jur_block"
group-by="ln:anmerkung[.=$val]">
				<xsl:value-of select="current-group()/ln:jur_block[1]/ln:zaehlung"/>
				<xsl:text> bis </xsl:text>
				<xsl:value-of select="current-group()/ln:jur_block[last()]/ln:zaehlung"/>
			</xsl:for-each-group>
			<xsl:text> </xsl:text>
			<xsl:apply-templates/>
		</xsl:when>
		<xsl:otherwise>
			<inline style="*fettkursiv">
				<xsl:text>Anm. d. Red.: </xsl:text>
			</inline>
			<xsl:apply-templates/>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

Can you help me with this problem?
Thank you very much.

wbr,
Roman

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.