Jump to content

paging XML


andreathedove

Recommended Posts

Hello,i am working here: http://www.allinonenet.it/compra_e_vendi/r...donna_e_bambinoAnd I have record per page "1", and with this code dont work:
<xsl:template name="footerPages"><xsl:param name="element" /><xsl:param name="pagenumber" /><xsl:variable name="total" select="count(//products/product/mCN[count(. | key('jobcode', text())[1]) = 1]) div $recordsPerPage"/><center><xsl:if test="$pagenumber > 1"><a href="?n={$pagenumber -1}&id={$id}&Cat={$category}&r={translate($r,' ' ,'_')}">Indietro</a></xsl:if><xsl:for-each select="*[name() = $element and position() <= ceiling($total)]"><xsl:choose><xsl:when test="not(count(preceding-sibling::*)+1 = $pagenumber)"> [<a href="?n={count(preceding-sibling::*)+1}&id={$id}&Cat={$category}&r={translate($r,' ' ,'_')}"><xsl:value-of select="count(preceding-sibling::*)+1" /></a>]</xsl:when><xsl:otherwise> <b>[<xsl:value-of select="count(preceding-sibling::*)+1" />]</b></xsl:otherwise></xsl:choose></xsl:for-each><xsl:if test="$pagenumber < $total"> <a href="?n={$pagenumber +1}&id={$id}&Cat={$category}&r={translate($r,' ' ,'_')}">Avanti</a></xsl:if></center><xsl:variable name="pageNumberControl" select="concat(count(preceding-sibling::*) + position() , '-', count(preceding-sibling::*) + $recordsPerPage)" /></xsl:template>

Andrea

Hello,nobody can you help me ? :-(Andrea
Link to comment
Share on other sites

  • Replies 54
  • Created
  • Last Reply

Top Posters In This Topic

What is the full XSLT you have? It seems you've steered away from the pagination framework I once gave you, and after all, the idea behind it was exactly so that you can later more easily develop pages that required pagination.

Link to comment
Share on other sites

What is the full XSLT you have? It seems you've steered away from the pagination framework I once gave you, and after all, the idea behind it was exactly so that you can later more easily develop pages that required pagination.
This is my XSLT Page:
<?xml version="1.0"?><xsl:stylesheet version="1.0"	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:zylom="http://www.zylomgames.com/rss/partnerprogram/">	<xsl:output method="html" encoding="ISO-8859-1"/>	<xsl:param name="pagenumber" select="0" /> 	<xsl:variable name="recordsPerPage" select="10" /> 	<xsl:param name="category"/>	<xsl:param name="r"/>	<xsl:param name="id"/>	<xsl:key name="jobcode" match="mCN" use="text()" />		<xsl:key name="job" match="programLogoPath" use="text()" />	<xsl:key name="prezzo" match="price" use="text()" />	  <xsl:template match = "*"><xsl:variable name="totale" select="count(//products/product[mCN=translate($r,'_' ,' ')])"/> <div id="dir">			<strong><xsl:value-of select="$r"/></strong> - <b>[ <xsl:value-of select="$totale"/> ]</b><br/><br/><table><xsl:for-each select="//products/product[mCN=translate($r,'_' ,' ')]"><xsl:sort select="text()" data-type="text" order="ascending"/>   <xsl:if test="position() >= (($pagenumber - 1) *$recordsPerPage) and position() <= ($pagenumber * $recordsPerPage)"><xsl:variable name="tot" select="count(key('jobcode',text()))"/><xsl:variable name="selezione" select="substring-after(text(),':')"/><tr><td><img src="{iU}" width='50px' height='59px'/></td><td>		 <a class="titoli" href="prodotti.asp?id={$id}&Cat={$category}&r={translate(text(),' ' ,'_')}"><b><xsl:value-of select="n"/></b></a><br/><xsl:value-of select="d"/></td><td> <b>				<xsl:value-of select="p"/></b><br/>Spese: <xsl:value-of select="sC"/><br/>Condizioni: <xsl:value-of select="con"/><br/>Totale: <xsl:value-of select="p + sC"/></td></tr></xsl:if>		</xsl:for-each></table></div>  <xsl:call-template name="footerPages"><xsl:with-param name="element" select="'product'" /><xsl:with-param name="pagenumber" select="$pagenumber" /></xsl:call-template></xsl:template><xsl:template name="footerPages"><xsl:param name="element" /><xsl:param name="pagenumber" /><xsl:variable name="total" select="count(//products/product[mCN=translate($r,'_' ,' ')]) div $recordsPerPage"/><center><xsl:if test="$pagenumber > 1"><a href="?n={$pagenumber -1}&id={$id}&Cat={$category}&r={translate($r,' ' ,'_')}">Indietro</a></xsl:if><xsl:for-each select="*[name() = $element and position() <= ceiling($total)]"><xsl:choose><xsl:when test="not(count(preceding-sibling::*)+1 = $pagenumber)"> [<a href="?n={count(preceding-sibling::*)+1}&id={$id}&Cat={$category}&r={translate($r,' ' ,'_')}"><xsl:value-of select="count(preceding-sibling::*)+1" /></a>]</xsl:when><xsl:otherwise> <b>[<xsl:value-of select="count(preceding-sibling::*)+1" />]</b></xsl:otherwise></xsl:choose></xsl:for-each><xsl:if test="$pagenumber < $total"> <a href="?n={$pagenumber +1}&id={$id}&Cat={$category}&r={translate($r,' ' ,'_')}">Avanti</a></xsl:if></center><xsl:variable name="pageNumberControl" select="concat(count(preceding-sibling::*) + position() , '-', count(preceding-sibling::*) + $recordsPerPage)" /></xsl:template></xsl:stylesheet>

Andrea

Link to comment
Share on other sites

This is my XSLT Page:
<?xml version="1.0"?><xsl:stylesheet version="1.0"	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:zylom="http://www.zylomgames.com/rss/partnerprogram/">	<xsl:output method="html" encoding="ISO-8859-1"/>	<xsl:param name="pagenumber" select="0" /> 	<xsl:variable name="recordsPerPage" select="10" /> 	<xsl:param name="category"/>	<xsl:param name="r"/>	<xsl:param name="id"/>	<xsl:key name="jobcode" match="mCN" use="text()" />		<xsl:key name="job" match="programLogoPath" use="text()" />	<xsl:key name="prezzo" match="price" use="text()" />	  <xsl:template match = "*"><xsl:variable name="totale" select="count(//products/product[mCN=translate($r,'_' ,' ')])"/> <div id="dir">			<strong><xsl:value-of select="$r"/></strong> - <b>[ <xsl:value-of select="$totale"/> ]</b><br/><br/><table><xsl:for-each select="//products/product[mCN=translate($r,'_' ,' ')]"><xsl:sort select="text()" data-type="text" order="ascending"/>   <xsl:if test="position() >= (($pagenumber - 1) *$recordsPerPage) and position() <= ($pagenumber * $recordsPerPage)"><xsl:variable name="tot" select="count(key('jobcode',text()))"/><xsl:variable name="selezione" select="substring-after(text(),':')"/><tr><td><img src="{iU}" width='50px' height='59px'/></td><td>		 <a class="titoli" href="prodotti.asp?id={$id}&Cat={$category}&r={translate(text(),' ' ,'_')}"><b><xsl:value-of select="n"/></b></a><br/><xsl:value-of select="d"/></td><td> <b>				<xsl:value-of select="p"/></b><br/>Spese: <xsl:value-of select="sC"/><br/>Condizioni: <xsl:value-of select="con"/><br/>Totale: <xsl:value-of select="p + sC"/></td></tr></xsl:if>		</xsl:for-each></table></div>  <xsl:call-template name="footerPages"><xsl:with-param name="element" select="'product'" /><xsl:with-param name="pagenumber" select="$pagenumber" /></xsl:call-template></xsl:template><xsl:template name="footerPages"><xsl:param name="element" /><xsl:param name="pagenumber" /><xsl:variable name="total" select="count(//products/product[mCN=translate($r,'_' ,' ')]) div $recordsPerPage"/><center><xsl:if test="$pagenumber > 1"><a href="?n={$pagenumber -1}&id={$id}&Cat={$category}&r={translate($r,' ' ,'_')}">Indietro</a></xsl:if><xsl:for-each select="*[name() = $element and position() <= ceiling($total)]"><xsl:choose><xsl:when test="not(count(preceding-sibling::*)+1 = $pagenumber)"> [<a href="?n={count(preceding-sibling::*)+1}&id={$id}&Cat={$category}&r={translate($r,' ' ,'_')}"><xsl:value-of select="count(preceding-sibling::*)+1" /></a>]</xsl:when><xsl:otherwise> <b>[<xsl:value-of select="count(preceding-sibling::*)+1" />]</b></xsl:otherwise></xsl:choose></xsl:for-each><xsl:if test="$pagenumber < $total"> <a href="?n={$pagenumber +1}&id={$id}&Cat={$category}&r={translate($r,' ' ,'_')}">Avanti</a></xsl:if></center><xsl:variable name="pageNumberControl" select="concat(count(preceding-sibling::*) + position() , '-', count(preceding-sibling::*) + $recordsPerPage)" /></xsl:template></xsl:stylesheet>

Andrea

nobody give me a solution, please ...
Link to comment
Share on other sites

  • 2 weeks later...

I am trying to solve your problem now (didn't had much time to use Stylus Studio... I was either at work, or too busy reviewing the forums for something simpler than your overcomplicated thing).I think I'm missing a source XML to create a test for. Can you provide a sample one for me please?On first glance, there are lots of places where you're selecting elements, but I'm not sure if you meant to select parameters instead. Remember, parameter names are preceded with "$".And again, keep in mind that what you are doing is NOT efficient. It WILL eventually blow up (by that I mean that it will become way too slow for anyone to accept). You need to completely redesign this if you are to prevent that.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...