xsl-list
[Top] [All Lists]

Re: Calling a template recursively

2004-07-02 04:41:44
Hello David,
           Thanks a lot for your help.
regards,
Ranjan
--- David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:

          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

________________________________________________________________________


--+------------------------------------------------------------------
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>
--+--




__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


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