xsl-list
[Top] [All Lists]

RE: Incrementing number in a for loop ??

2003-07-31 11:06:56
Hi Ken,

Thanks a mile. This is exactly what i was trying to do.

Thanks !!
Regards,
Dipesh

Date: Thu, 31 Jul 2003 10:41:43 -0400
From: "G. Ken Holman" <gkholman(_at_)CraneSoftwrights(_dot_)com>
Subject: RE: [xsl] Incrementing number in a for loop ??

At 2003-07-31 09:44 -0400, Dipesh Khakhkhar wrote:
When i m parsing my xsl file i m creating quotes like this and it is
HARDCODED
and this I counted and put into my xsl file as show below where at
someplace i
need like this.

<xsl:text>
``````````````````````````````</xsl:text>
And at other place i need something like this.
<xsl:text>
``````</xsl:text>
...
int quoteCount = 30; // for example this many quotes i need
for(int i = 0; i < quoteCount ; i++)
printf("`");

I hope this helps.

............ Ken

T:\ftemp>type dipesh.xsl
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">

<xsl:output method="text"/>

<xsl:template match="/">
<xsl:text>First is 30: </xsl:text>
<xsl:call-template name="do-quotes">
<xsl:with-param name="count" select="30"/>
</xsl:call-template>
<xsl:text>&#xa;Second is only 20: </xsl:text>
<xsl:call-template name="do-quotes">
<xsl:with-param name="count" select="20"/>
</xsl:call-template>
</xsl:template>

<xsl:template name="do-quotes">
<xsl:param name="count" select="0"/>
<xsl:if test="$count">
<xsl:text>'</xsl:text>
<xsl:call-template name="do-quotes">
<xsl:with-param name="count" select="$count - 1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>

</xsl:stylesheet>
T:\ftemp>saxon dipesh.xsl dipesh.xsl
First is 30: ''''''''''''''''''''''''''''''
Second is only 20: ''''''''''''''''''''
T:\ftemp>


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



<Prev in Thread] Current Thread [Next in Thread>