Subject: RE: [xsl] Another (positional?) grouping problem From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Thu, 19 Oct 2006 15:07:10 +0100 |
Try <xsl:for-each-group select="* except BALANCE_OLD" group-starting-with="DATE"> Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: Rudolf P. Weinmann [mailto:rudolf.weinmann@xxxxxxxxxxxx] > Sent: 19 October 2006 14:54 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] Another (positional?) grouping problem > > Hi > > Could anybody please tell me how to solve the following > grouping problem with xslt 2.0? > > The input isn't structured. There is a root element and a > sequence of elements. > Input: > <DOC> > <BALANCE_OLD>3141.70</BALANCE_OLD> > <DATE>2006-04-26</DATE> > <VALUE_DATE>2006-04-25</VALUE_DATE> > <TEXT>text 1</TEXT> > <TEXT>text 2</TEXT> > <TEXT>text 3</TEXT> > <TEXT>text 4</TEXT> > <AMOUNT>315.00</AMOUNT> > <BALANCE_NEW>3456.70</BALANCE_NEW> > <DATE>2006-04-28</DATE> > <VALUE_DATE>2006-04-26</VALUE_DATE> > <TEXT>Text 1</TEXT> > <TEXT>Text 2</TEXT> > <AMOUNT>465.00</AMOUNT> > <BALANCE_NEW>3921.70</BALANCE_NEW> > </DOC> > > Each DATE element is the start of a group. The end of the > group is either the next DATE element or the end of the input. > I need to put the elements of each group into a <Transaction> > element as follows: > > <Trx> > <Transaction> > <Date>2006-04-26</Date> > <ValueDate>2006-04-25</ValueDate> > <Text>text 1</Text> > <Text>text 2</Text> > <Text>text 3</Text> > <Text>text 4</Text> > <Amount>315.00</Amount> > <NewBalance>3456.70</NewBalance> > </Transaction> > <Transaction> > <Date>2006-04-28</Date> > <ValueDate>2006-04-26</ValueDate> > <Text>Text 1</Text> > <Text>Text 2</Text> > <Amount>465.00</Amount> > <NewBalance>3921.70</NewBalance> > </Transaction> > </Trx> > > How can this be done with xslt 2.0? > > Any help greatly appreciated, > Rudolf
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Another (positional?) groupin, Rudolf P . Weinmann | Thread | Re: [xsl] Another (positional?) gro, Rudolf P . Weinmann |
[xsl] Another (positional?) groupin, Rudolf P . Weinmann | Date | [xsl] RE: xsl-list Digest 19 Oct 20, McDonald, Shaun |
Month |