Hi
I try to achieve a multilevel grouping on attributes:
I got several items like these
<SI>
<eintrag pos="181" paragraph="3">aa</eintrag>
<eintrag pos="182" paragraph="3" absatz="1">aa</eintrag>
<eintrag pos="183" paragraph="3" absatz="1">bb</eintrag>
<eintrag pos="184" paragraph="3" absatz="2" a_litera="a" >aa</eintrag>
<eintrag pos="185" paragraph="3" absatz="2" a_litera="a"
ziffer="15">aa</eintrag>
<eintrag pos="186" paragraph="3" absatz="2" a_litera="a"
ziffer="15">bb</eintrag>
<eintrag pos="187" paragraph="3" absatz="2" ziffer="16">aa</eintrag>
<eintrag pos="188" paragraph="5" absatz="5">aa</eintrag>
<eintrag pos="189" paragraph="5" absatz="5" a_litera="a">aa</eintrag>
</SI>
Result should be:
<SI>
<document>
<eintrag pos="180" paragraph="3">aa</eintrag>
<eintrag pos="181" paragraph="3">bb</eintrag>
</document>
<document>
<eintrag pos="182" paragraph="3" absatz="1">aa</eintrag>
<eintrag pos="183" paragraph="3" absatz="1">bb</eintrag>
</document>
<document>
<eintrag pos="184" paragraph="3" absatz="2">aa</eintrag>
</document>
<document>
<eintrag pos="185" paragraph="3" absatz="2" a_litera="a"
ziffer="15">aa</eintrag>
<eintrag pos="186" paragraph="3" absatz="2" a_litera="a"
ziffer="15">bb</eintrag>
</document>
</SI>
I started with:
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" >
<xsl:output method="xml" version="1.0" encoding="UTF-8"
indent="yes"/>
<xsl:template match="/">
<SI>
<xsl:for-each-group select="//eintrag" group-by="@paragraph">
<xsl:choose>
<xsl:when
test="current-group()/@absatz">
<xsl:for-each-group
select="current-group()" group-by="@absatz">
<document>
<xsl:copy-of
select="current-group()" copy-namespaces="no"/>
</document>
</xsl:for-each-group>
</xsl:when>
<xsl:otherwise>
<document>
<xsl:copy-of
select="current-group()" copy-namespaces="no"/>
</document>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each-group>
</SI>
</xsl:template>
</xsl:stylesheet>
The problem is, I loose the <entry> which has no @absatz.
What is the right <xsl:choose> to achieve the required result.
Thx
Christoph
--~------------------------------------------------------------------
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>
--~--