[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] for-each-group but not the first?
Subject: RE: [xsl] for-each-group but not the first? From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Tue, 15 Feb 2005 18:00:12 -0000 |
Try <xsl:if test="self::kapitel-container"> immediately within the for-each-group. (Within for-each-group, the current item is the first item of the current group). Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: gregor FELLENZ [mailto:gf_public@xxxxxxx] > Sent: 15 February 2005 17:17 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] for-each-group but not the first? > > 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> > [...]
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] for-each-group but not th, David Carlisle | Thread | [xsl] Multiple CDATA tags, John Cole |
RE: [xsl] Saxon: java extension fun, Michael Kay | Date | Re: [xsl] Multiple CDATA tags, David Carlisle |
Month |
Keywords