This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

paging problem -can't seem to figure it out


Hey guys

Thanks for the help so far!! I was hoping that somebody could help me out as 
I am really stuck with my paging problem.  I have looked back at responses 
on the list and taken into account previous suggestions but I am still no 
clearer.  I am using the code below to transform the xml document.  Nothing 
is happening.  Any suggestions would be really appreciated.  Previous 
suggestions said that I had to use the true XSLT namespace. Have I included 
the right one??

Thanks in advance
Cheers Rach


---------------------XSL file
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0";>
<xsl:template match="/">

<HTML>

<BODY>

<TABLE>


<xsl:param name="recordsPerPage" select="10"/>

<xsl:param name="pageNumber"/>

<xsl:if test="position() &gt;= $recordsPerPage * number($pageNumber) and
position() &lt;= number($recordsPerPage * number($pageNumber) +
$recordsPerPage)">

   <xsl:element name="tr">
   <xsl:if test="position() mod 2 = 0">
	<xsl:attribute name="bgcolor">#ffffcc</xsl:attribute>
   </xsl:if>

      <xsl:element name="td">
	<xsl:value-of select="position()"/>
      </xsl:element>

      <xsl:element name="td">
            <xsl:value-of select="ALL/CATEGORY/title"/>
      </xsl:element>
      <xsl:element name="td">
         <xsl:value-of select="ALL/CATEGORY/desc"/>
      </xsl:element>
      <xsl:element name="td">
         <xsl:value-of select="ALL/CATEGORY/href"/>
      </xsl:element>
   </xsl:element>
</xsl:if>


<xsl:if test="$pageNumber &gt; 0">
	<xsl:element name="a">
		<xsl:attribute
name="href">?page=myxmlpage&amp;sort=<xsl:value-of
select='$sortField'/>&amp;pagenumber=<xsl:value-of
select="number($pageNumber)-1"/></xsl:attribute>
		&lt;&lt; Previous Page
	</xsl:element>
	&#160; &#160; &#160; &#160;
</xsl:if>


<xsl:if test="($timekeeperCount - ((1+number($pageNumber)) *
$recordsPerPage)) > 0">
	<xsl:element name="a">
		<xsl:attribute
name="href">?page=myxmlpage&amp;sort=<xsl:value-of
select='$sortField'/>&amp;pagenumber=<xsl:value-of
select="number($pageNumber)+1"/></xsl:attribute>
		Next page &gt;&gt;
	</xsl:element>
</xsl:if>
</center>

</TABLE>

</BODY>
</HTML>

  </xsl:template>
</xsl:stylesheet>Hey guys

Thanks for the help so far!! I was hoping that somebody could help me out as 
I am really stuck with my paging problem.  I have looked back at previous 
stuff on the list and taken into account previous suggestions but I am still 
no clearer.  I am using the code below to transform the xml document.  
Nothing is happening.  Any suggestions would be really appreciated.  
Previous suggestions said that I had to use the true XSLT namespace. Have I 
included the right one??

Thanks in advance
Cheers Rach


---------------------XSL file
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0";>
<xsl:template match="/">

<HTML>

<BODY>

<TABLE>


<xsl:param name="recordsPerPage" select="10"/>

<xsl:param name="pageNumber"/>

<xsl:if test="position() &gt;= $recordsPerPage * number($pageNumber) and
position() &lt;= number($recordsPerPage * number($pageNumber) +
$recordsPerPage)">

   <xsl:element name="tr">
   <xsl:if test="position() mod 2 = 0">
	<xsl:attribute name="bgcolor">#ffffcc</xsl:attribute>
   </xsl:if>

      <xsl:element name="td">
	<xsl:value-of select="position()"/>
      </xsl:element>

      <xsl:element name="td">
            <xsl:value-of select="ALL/CATEGORY/title"/>
      </xsl:element>
      <xsl:element name="td">
         <xsl:value-of select="ALL/CATEGORY/desc"/>
      </xsl:element>
      <xsl:element name="td">
         <xsl:value-of select="ALL/CATEGORY/href"/>
      </xsl:element>
   </xsl:element>
</xsl:if>


<xsl:if test="$pageNumber &gt; 0">
	<xsl:element name="a">
		<xsl:attribute
name="href">?page=myxmlpage&amp;sort=<xsl:value-of
select='$sortField'/>&amp;pagenumber=<xsl:value-of
select="number($pageNumber)-1"/></xsl:attribute>
		&lt;&lt; Previous Page
	</xsl:element>
	&#160; &#160; &#160; &#160;
</xsl:if>


<xsl:if test="($timekeeperCount - ((1+number($pageNumber)) *
$recordsPerPage)) > 0">
	<xsl:element name="a">
		<xsl:attribute
name="href">?page=myxmlpage&amp;sort=<xsl:value-of
select='$sortField'/>&amp;pagenumber=<xsl:value-of
select="number($pageNumber)+1"/></xsl:attribute>
		Next page &gt;&gt;
	</xsl:element>
</xsl:if>
</center>

</TABLE>

</BODY>
</HTML>

  </xsl:template>
</xsl:stylesheet>
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]