I know there are some questions about this here, and I tried a lot of solutions around but i'm still stuck. I tried to use this pagination in xsl and this Possible to split XML into multiple pages with XSLT? but don't get what I need,
I need to create a pagination in my generated html, using a XML through a XSLT parser.
XML file is like this
<root>
<result>
<a>field one</a>
<b>field two</b>
<c>field three</c>
</result>
<result>
<a>hello</a>
<b>thanks</b>
<c>for help</c>
</result>
<result>
<a>thank</a>
<b>you</b>
<c>!!</c>
</result>
.....
</root>
and my XSLT without pagination is this
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:user="http://mycompany.com/mynamespace">
<xsl:output method="html" indent="yes" />
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:template match="root">
<xsl:for-each select="result">
<div class="list_item">
<div class="dmv_line">
<div class="box_text">
<h2><xsl:value-of select="a"/></h2>
</div>
</div>
<div class="dmv_line">
<div class="box_text">
<h2><xsl:value-of select="b"/></h2>
</div>
</div>
<div class="dmv_line">
<div class="box_text">
<h2><xsl:value-of select="c"/></h2>
</div>
</div>
</div>
</div>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
What I need is to create a <div> that encapsulate results 3 by 3 or 4 by 4, which I will make hide or visible in javascript later..
Thanks
[EDIT]: The HTML output, if I assume to make pagination 2 elements per page, and considering only the 3 elements in example, the output should be
<-- page number one --->
<div id="1">
<div class="list_item">
<div class="dmv_line">
<div class="box_text">
<h2>field one</h2>
</div>
</div>
<div class="dmv_line">
<div class="box_text">
<h2>field two</h2>
</div>
</div>
<div class="dmv_line">
<div class="box_text">
<h2>field three</h2>
</div>
</div>
</div>
<div class="list_item">
<div class="dmv_line">
<div class="box_text">
<h2>hello</h2>
</div>
</div>
<div class="dmv_line">
<div class="box_text">
<h2>thanks</h2>
</div>
</div>
<div class="dmv_line">
<div class="box_text">
<h2>for help</h2>
</div>
</div>
</div>
</div>
<-- END OF page number one --->
<-- page number two --->
<div id="2">
<div class="list_item">
<div class="dmv_line">
<div class="box_text">
<h2>thank</h2>
</div>
</div>
<div class="dmv_line">
<div class="box_text">
<h2>you</h2>
</div>
</div>
<div class="dmv_line">
<div class="box_text">
<h2>!!!</h2>
</div>
</div>
</div>
</div>
<-- END OF page number two --->