[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Another (positional?) grouping problem
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: 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|