xsl-list
[Top] [All Lists]

RE: [xsl] Another (positional?) grouping problem

2006-10-19 07:07:29
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(_dot_)weinmann(_at_)assentis(_dot_)com] 
Sent: 19 October 2006 14:54
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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

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



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