xsl-list
[Top] [All Lists]

updating a param value for recursion

2005-04-21 07:45:05
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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



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