Re: [xsl] Calling a template recursively

Subject: Re: [xsl] Calling a template recursively
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 2 Jul 2004 12:34:20 +0100
>           I am using following template to display a
> <br> tag 

Do you mean you want to insert a br element at that position?
If so you want to use the syntax <br/> in the stylesheet.

You have used
<xsl:text>&lt;br&gt; </xsl:text>
which does not insert an element at all it just inserts the five
characters < b r > that string of characters will not be written out as
a tag when the XSLT system outputs your result tree to a file.

aside from that the logic for terminating your recursion is faulty
$temp is the first 25 characters
but then you define $temp2 to be the characters of $temp from position
26 on, so this will always be empty. You want to use the original
$releaselevel parameter here not $temp.

finally in your parameter you have used @temp2 ie an attribute called
temp2 which is also most likely empty.

In fact you don't need either variable definition, instead of

   
                   <xsl:variable name="temp"
      select="substring($releaselevel,1,25)"/>
                   <xsl:value-of select="$temp"/>

you can use


                <xsl:value-of
select="substring($releaselevel,1,25)"/>


and instead of

                        
                           <xsl:variable name="temp2"
   select="substring($temp,26,string-length($releaselevel))"/>
                        <xsl:value-of select="$temp2"/>
                           <xsl:call-template name="normaliseString">
                                <xsl:with-param  name="releaselevel"
                     select="@temp2"/>

you can use

      <xsl:call-template name="normaliseString">
                                <xsl:with-param  name="releaselevel"
                     select="substring($releaselevel,26)"/>



and of course, instead of

   <xsl:text>&lt;br&gt; </xsl:text>


use

  <br/>

David

-- 
The LaTeX Companion
  http://www.awprofessional.com/bookstore/product.asp?isbn=0201362996
  http://www.amazon.co.uk/exec/obidos/tg/detail/-/0201362996/202-7257897-0619804


________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread