[xsl] updating a param value for recursion

Subject: [xsl] updating a param value for recursion
From: RahilQ <qamar_rahil@xxxxxxxxxxx>
Date: Thu, 21 Apr 2005 15:45:05 +0100
Hi

Ive tried to look through the archives for a previous example similar to my query but I couldnt find any. Hence would appreciate any help.

I have a string of the form '<Value>at1000 First at2000 Second at3000 Third</Value>'

I would like an output of the form
<Value ref="at1000">First</Value>
<Value ref="at2000">Second</Value>
<Value ref="at3000">Third</Value>

I have written a template for this

<xsl:template name="atCodes">
<xsl:param name="atStr"/> <!--receives string of the form 'at1000 First at2000 Second at3000 Third'-->
<Value>
<xsl:attribute name="ref" select="substring-before($atStr,$splitString)"/> <!--$splitString = ' '-->
<xsl:variable name="interim" select="normalize-space(substring-after($atStr,$splitString))"/>
<xsl:value-of select="substring-before($interim,$splitString)"/>
</Value>
<xsl:call-template name="atCodes">
<xsl:with-param name="intem" select="substring-after($interim,$splitString)"/> <!--Generates compilation error for $interim-->
</xsl:call-template>
</xsl:template>


The compiler rightly complains that the '$interim' variable isnt declared.

What Id really like is for the param '$atStr' to be updated in the <Value> block. I was thinking of using the replace() function but dont know how to implement it in this case.

Suggestions please.

Thanks
Rahil

Current Thread