xml counter

19 views
Skip to first unread message

simos

unread,
Jun 25, 2008, 10:49:06 AM6/25/08
to XML Schema
Hello everyone,

i have the following xsl, and i want to display 10 products with no 0
value.
it looks like the counter it doesnt work. Is there anyone to help out,
please?

Regards,
-------------------------------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet
version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" omit-xml-declaration="yes"/>

<xsl:template match="/">
<xsl:call-template name="clearance" />
</xsl:template>

<xsl:template name="clearance">

<xsl:param name="num">0</xsl:param> <!-- count value -->

<xsl:for-each select="electricalClear/p">

<xsl:variable name="tpnID"><xsl:value-of select="tpn" /></
xsl:variable>

<xsl:if test="document('stocklevel.xml')/stocklevel/p[@tpn=
$tpnID] > 0">

<xsl:if test="not($num = 10)">


<div style="float: left; padding: 10px; width: 200px; border:
1px solid #000;">

<h3><xsl:value-of select="tpn" />: in stock</h3>
<p>was: <xsl:value-of select="was" /> / now: <xsl:value-of
select="now" /></p>
<p>image: <xsl:value-of select="image" /> / link: <xsl:value-
of select="url" /></p>
</div>

<xsl:call-template name="clearance">
<xsl:with-param name="num">
<xsl:value-of select="$num + 1"/>
</xsl:with-param>
</xsl:call-template>

</xsl:if> <!-- bigger than 0 -->

</xsl:if> <!-- count to 10 -->

</xsl:for-each>

</xsl:template>
</xsl:stylesheet>
Reply all
Reply to author
Forward
0 new messages