xsl-list
[Top] [All Lists]

?group? but keep order of elements

2002-10-22 07:28:10
Hallo again,
(my first mail today somehow did not get through to the list)
again I read through the faqs (to Bryan S. Schnabel: the list with the p in it) 
and without any result. There are partly answers but not the answer I am 
looking for. I am not sure whether grouping is the right direction. 
I can not really fix a position. I can only say: Use the node <texteintrag> for 
all entries up to the next <uebung>, than take the node <uebung> up to the 
point where <texteintrag> starts again. Actually I would think of xsl:if or 
xsl:when, but if I choose these how can I keep the strucure? I simply need an 
xslt that transforms my xml, adds new elements and comprises the child elements 
and following siblings. Do I need something completely different to my 
stylesheet or is there a way to continue?

I would be grateful just for a little hint, not a perfect solution.

This is my stylesheet:

<xsl:template match="entry[not(MAT/Fundstelle/UbNummer)]">
<xsl:copy>  
<texteintrag>
<xsl:apply-templates/>
</texteintrag>
</xsl:copy>
</xsl:template>
<xsl:template match="entry[(MAT/Fundstelle/UbNummer)]">
<xsl:copy>  
<uebung>
<xsl:apply-templates/>
</uebung>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

The result:

<total>
<texteintrag>
<entry></entry>
</texteintrag>
<texteintrag>
<entry></entry>
</texteintrag>
(I do not know how many)
<uebung>
<entry>
<UbNummer></UbNummer>
</entry>
</uebung>
<uebung>
<entry>
<UbNummer></UbNummer>
</entry>
</uebung>
(I do not know how many)
</total>

I want:

<total>
<texteintrag>
<entry></entry>
<entry></entry>
</texteintrag>
(I do not know how many)
<uebung>
<entry>
<UbNummer></UbNummer>
</entry>
<entry>
<UbNummer></UbNummer>
</entry>
</uebung>
(I do not know how many)
</total>

Thanks in advance
Elke
*******************************************************
Elke Naraschewski - Ernst Klett Verlag GmbH -
Leistungscenter Mediengestaltung

Rotebühlstr. 77 - 70178 Stuttgart
Tel.: 0711/6672-1116 - Fax: 0711/6672-2023 - E-mail:
e(_dot_)naraschewski(_at_)klett-mail(_dot_)de

Stuttgart HRB 10746 - Verleger: Dr.h.c. Michael Klett
Geschäftsführer: Johannes Leßmann - Harald Melcher - Dr. Tilmann Michaletz - 
Dr. Wolf Unkelbach (Vorsitz)


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



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