xsl for each for every 5 element

M

metehan

I have below xml document with Kbase element,i doing paging.
paging part is done. Now I need to linking.
I am displaying 5 elements for each page
so How do i write a for loop that displays for the amount of elements
below and writes
1 2 3

i wrote below and no go

<xsl:for-each select="//Kbase">
<xsl:if test="position() &gt; ($Page * $PageSize) + 1">
<xsl:if test="position() &lt; $PageSize + ($PageSize * $Page)">
<a href="JavaScript:changePage(5);">
<xsl:value-of select="position()"/>
</a>
</xsl:if>
</xsl:if>
</xsl:for-each>





<Kbase id="KB709966"/>
<Kbase id="KB709966"/>
<Kbase id="KB709966"/>
<Kbase id="KB709966"/>
<Kbase id="KB709966"/>
<Kbase id="KB709966"/>
<Kbase id="KB709966"/>
<Kbase id="KB709966"/>
<Kbase id="KB709966"/>
<Kbase id="KB709966"/>
<Kbase id="KB709966"/>
 
D

Dimitre Novatchev [MVP XML]

metehan said:
I have below xml document with Kbase element,i doing paging.
paging part is done. Now I need to linking.
I am displaying 5 elements for each page
so How do i write a for loop that displays for the amount of elements
below and writes
1 2 3


Look in the xsl faq about producing a table with N number of columns.

Or here:
http://www.topxml.com/code/default.asp?p=3&id=v20020514091249

Cheers,

Dimitre Novatchev [XML MVP],
FXSL developer, XML Insider,

http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html
 
M

metehan

I get around it
here is the script
<xsl:template match="rowset">
<xsl:for-each select="row[position() mod 5 = 1]">
<xsl:number/><br/>
<!--<xsl:apply-templates select=". |
following-sibling::row[position() &lt; 5]" /><br/>-->

</xsl:for-each>
</xsl:template>


Dimitre Novatchev said:
metehan said:
I have below xml document with Kbase element,i doing paging.
paging part is done. Now I need to linking.
I am displaying 5 elements for each page
so How do i write a for loop that displays for the amount of elements
below and writes
1 2 3


Look in the xsl faq about producing a table with N number of columns.

Or here:
http://www.topxml.com/code/default.asp?p=3&id=v20020514091249

Cheers,

Dimitre Novatchev [XML MVP],
FXSL developer, XML Insider,

http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top