[xsl] how to group equal nodes by a it's position()

Subject: [xsl] how to group equal nodes by a it's position()
From: Dmitri Ilyin <dmitri.ilyin@xxxxxxxxx>
Date: Fri, 28 Sep 2001 21:15:17 +0200
Hi *,

i have next xml:

<calls>
 <call>sme text</call>
 <call>sme text</call> 
 <call>sme text</call>
 <call>sme text</call>
 <call>sme text</call>
 <call>sme text</call>
 <call>sme text</call>
 <call>sme text</call>
 <call>sme text</call>
 <call>sme text</call>
 .....
 <call>sme text</call>
</calls>

i have to group the <call> by it's position()
to get 
<table_1>
 <call>some text</call> 
 from position 1 to 10 (10 elements in the table_1)
 <call>some text</call> 
</table_1>
<table_2>
 <call>some text</call> 
  from position 11 to 25 (15 elements in table_2)
</table_2>
....
<table_n>
 <call>some text</call> 
  from position 26 to 40 (15 elements in table_n)
</table_n>

<table_x>
 <call>some text</call> 
  from position nnn to mmm (20 elements or less in table_x)
</table_x>

So I have 3 types of tables, with 10, 15, 20 elements.
The number of call nodes in table 1 must be 10 and it must be first 10
elements,
the number of call nodes in tables 2 to n must be 15,
the number of call nodes in last table must be 20 or less.

the number of call elements can be different. 
eg i have 100 call elements
so i have to put in the first table 10 elements, 
in the tables from 2..6 15 elements
and in the last table 15 elements. 

If i have 106 elements i could put in last table 20 (and make the last table
complete) 
elements end still have ones more element, 
so i have to create one more table with 15 elements and put in the last
table the last 6 elements.


are there any solutions of that problem???

thanks for advise

Dmitri

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread