[xsl] Help needed to make XSL for my XML

Subject: [xsl] Help needed to make XSL for my XML
From: "Lim Siew Yin" <limsy@xxxxxxxxxxxxxxxxxx>
Date: Sat, 6 Nov 2004 13:46:52 +0800
Hi ppl,

I have an XML file with multiple groupings of data I needed to process.
eg.
<tag1>
   <tag11>
     <tagXX>
       <DATA1>
       <DATA2>
     <tagXX>
       <DATA1>
       <DATA2>
<tag2>
   <tag21>
     <tagXX>
       <DATA1>
       <DATA2>

To me, I am only interested to group all the tagXX and process their data.  I need to group all occurances of tagXX, and to print out their data.  So far, I can do this using...
 <xsl:apply-templates select="//tagXX"/>

However, I also need to do paging.  I added 2 parameters (Start and PageSize) to control the retrieval and ended up with...
 <xsl:apply-templates select="//tagXX[position() &gt;= $pStartRecord  and position() &lt; ($pStartRecord + $pDataPageSize)]"/>

Problem is, the above treats different occurances of tagXX separately.
Which means, it is applied repeatly for each occurance.
eg.
1st grouping of tagXX contains 10 instance.
2nd grouping of tagXX contains 3 instance.
3rd grouping of tagXX contains 5 instance.

If my Start is 1 and my pagesize is 5,  (1st page)

I ended up with 5 + 3 + 5 records.

And if my Start is 6 and my pagesize is 5, (2nd page)

I ended up with 5 + 0 + 0 records.


Can someone help me? I have already wasted 3 days at this but with no avail.  Any info/help is greatly appreciated.  Thank you for your time.


SY Lim.

Current Thread