This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
URGENT: Please help
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Subject: [xsl] URGENT: Please help
- From: Ram Gande <Ram dot Gande at exodus dot net>
- Date: Wed, 25 Apr 2001 17:22:10 -0700
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi all,
I am new to XSLT programming. I have a few external function that I am
calling.
What I want to do is to print out a bunch of "href" based on the successive
calls to the external java function. I know how many number of rows coming
by calling "count" function. I want to loop through this "count" and create
"tr" rows inside my table.
Can anyone please let me know how I can loop
eg.,
for (expression)
counter = counter + 1
if (counter < maxcount)
exit
else
"Create TR"
next
I have tried to do by recursively call the "template" but I must not be
doing something. How can I check the expression and increment the counter.
Anyhelp would be greatly apprciated. Below is my sample code.
Thanks
RK.
****************************************************************************
**************************************************************
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:java="http://xml.apache.org/xslt/java" xmlns:dcs="dcs"
extension-element-prefixes="java, dcs">
<xsl:output method="html" indent="no"/>
<xsl:include xml:link="include" href="param.xslt" />
<xsl:param name="spos" select="0" />
<xsl:template name="getNextCust">
<xsl:value-of select="&getNext;()"/>
</xsl:template>
<xsl:template name="setFilter">
<xsl:value-of select="&setFilter;('Ad*')"/>
</xsl:template>
<xsl:template name="getCount">
<xsl:value-of select="&count;()"/>
</xsl:template>
<xsl:variable name="matchcount" select="&count;()"/>
<xsl:template match="*">
<HTML>
<HEAD>
<TITLE>
<xsl:value-of select="$system.title"/> - Select Customer
</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function search ()
{
<xsl:call-template name="setFilter"/>
}
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="SearchForm" method="POST"
action="/servlet/dcs/?do:method=search">
<INPUT TYPE="text" NAME="search" SIZE="10"/>
<INPUT TYPE="button" VALUE="Search"
onClick="javascript:search()"/>
</FORM>
<xsl:value-of select="&setFilter;('Ban*')"/>
<table width="%100" border="0" cellspacing="0" cellpadding="0"
valign="bottom" nowrap="true">
<xsl:call-template name="rows">
<xsl:with-param name="first" select="0"/>
</xsl:call-template>
</table>
</BODY>
</HTML>
</xsl:template>
<xsl:template name="rows">
<xsl:param name="first"/>
<xsl:choose>
<xsl:when test="$matchcount > $first">
<tr align="left">
<td rowspan="1" align="left">
<font color="#ffffff" face="{font_style}"
size="2">
<a target="selectcust"
href="http://www.ramg.com">
<xsl:value-of select="&getNext;()"/>
</a>
</font>
</td>
</tr>
<xsl:call-template name="rows">
<xsl:with-param name="first" select="$first"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
****************************************************************************
**************************************************************
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list