xsl-list
[Top] [All Lists]

RE: Grouping similar elements and putting out information about the first and the last member

2005-02-24 02:59:59

Solved it. 
Thanks.

wbr,
Roman
 

-----Ursprüngliche Nachricht-----
Von: Huditsch Roman [mailto:Roman(_dot_)Huditsch(_at_)lexisnexis(_dot_)at] 
Gesendet: Donnerstag, 24. Februar 2005 09:25
An: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Betreff: [xsl] Grouping similar elements and putting out 
information about the first and the last member

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 vermögensrechtlichen 
Beziehungen der Ehegatten aus einer für nichtig erklärten 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

--~------------------------------------------------------------------
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>
--~--



<Prev in Thread] Current Thread [Next in Thread>