xsl-list
[Top] [All Lists]

for-each-group but not the first?

2005-02-15 10:17:28
hello

i've a flat xml-doc that i want to structure with the for-each-group function. everything ist working fine, but i cant deselect the first group (wgicg i dont need). i've experimented with several ideas but i can't find the solution.


any help would be great!

thank you

gregor


-- My XSLT -------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns:fn="http://www.w3.org/2004/07/xpath-functions"; xmlns:xdt="http://www.w3.org/2004/07/xpath-datatypes";>
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>

<xsl:template match="@*|node()" priority="-1">
  <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template>

<xsl:template match="ehapa">
        <ehapa>
        <xsl:for-each-group select="*" group-starting-with="kapitel-container">
                <xsl:element name="kapitel" >
                        <xsl:attribute name="abschnittsmarke" 
select="@abschnittsmarke"/>
                        <xsl:attribute name="nav-titel" select="@nav-titel"/>   
                                              
<xsl:for-each-group select="current-group()" group-starting-with="headline-container">
                        <xsl:element name="artikel" >
                                <xsl:attribute name="nav-titel" 
select="@nav-titel"/>
                                          <xsl:for-each 
select="current-group()">
                                          <xsl:copy>
                                                  <xsl:apply-templates 
select="@*|node()"/>
                                        </xsl:copy>
                                </xsl:for-each>
                        </xsl:element>
                </xsl:for-each-group>
                </xsl:element>    
        </xsl:for-each-group>
        </ehapa>
</xsl:template>

</xsl:stylesheet>


-- What I get ... using built in XMLSPY 2005 Home Processor ---
<?xml version="1.0" encoding="UTF-8"?>
<ehapa>
        <kapitel abschnittsmarke="Einleitung" nav-titel="e00">
        <artikel nav-titel="e00">
<kapitel-container abschnittsmarke="Einleitung" art="kapitel-start" nav-titel="e00">
                [..]
                </kapitel-container>
        </artikel>
        
        <artikel nav-titel="e00_ein01">
                <headline-container art="headline" nav-titel="e00_ein01">
                [...]
                </headline-container>
        </artikel>
        [...]
        </kapitel>
        [...]
</ehapa>

-- What I need - The same without the first group ----
<?xml version="1.0" encoding="UTF-8"?>
<ehapa>
        <kapitel abschnittsmarke="Einleitung" nav-titel="e00">
        <artikel nav-titel="e00_ein01">
                <headline-container art="headline" nav-titel="e00_ein01">
                [...]
                </headline-container>
        </artikel>
        [...]
        </kapitel>
        [...]
</ehapa>


--- My Source ist ---------
<ehapa>
<kapitel-container abschnittsmarke="Einleitung" art="kapitel-start" nav-titel="e00">[...]</kapitel-container> <headline-container art="headline" nav-titel="e00_ein01">[...]</headline-container> <artikel-container art="textbox" nav-titel="e00_ein01">[...]>/artikel-container> <artikel-container art="textbox" nav-titel="e00_ein01">[...]>/artikel-container> <artikel-container art="textbox" nav-titel="e00_ein01">[...]>/artikel-container> <headline-container art="headline" nav-titel="e00_ein01">[...]</headline-container>
        [...]

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