p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

xslt thread: Padding Text

Message #1 by "William Carlo Roncallo" <roncalw@y...> on Fri, 20 Jul 2001 14:34:12
Here's how I would solve the problem:

Call a template that calculates the remaining numbers up to 7.
You don't really need $numneeded. Here's one way to write the new template:

<xsl:template name="upTo7">
<xsl:param name="startingAt"/>
<xsl:if test="$startingAt<=7">
	<xsl:value-of select="$startingAt"/>
	<xsl:text>default value </xsl:text>
	<xsl:call-template name="upTo7">
		<xsl:with-param name="startingAt" select="$startingAt+1"/>

Call it from the main template using this:
<xsl:if test="position() = last()">
	<xsl:call-template name="upTo7">
	       <xsl:with-param name="startingAt" select="position()+1"/>


> The code that I am stuck on, is what to do with the variable, $numneeded.
> I somehow want to take that number and count out that many more, and 
> add a default value eventually next to each number.
> As always, any help would be greatly appreciated.
> Thanks and Cheers .....!!!!

  Return to Index