[xsl] big recursive function

Subject: [xsl] big recursive function
From: jon wa <jonni@xxxxxxxxx>
Date: Wed, 28 Nov 2001 12:25:52 +0100 (MET)
i have an xhtml file as input which i convert to plain text output. for
<pre> tags i have to output as is but indent every line by 4 spaces. no

if the string $table is not empty then print 4 spaces and the string up to
the first LF then call itself again with the rest of the string.

<xsl:template name="format">
<xsl:param name="table"/>
    <xsl:when test="string-length($table) > 0">
<xsl:value-of select="'    '"/><xsl:value-of
select="concat(substring-before($table, '&#10;'), '&#10;')"/>
      <xsl:call-template name="format">
        <xsl:with-param name="table">
          <xsl:value-of select="substring-after($table, '&#10;')"/>

my problem then comes when i have a big pre section to process. the function
recurses so many times that my parser (gnome libxslt) throws an error. it
seems as tho i can increase the depth that it will recurse but i haven't found
a way to do it with the perl interface i'm using.

so my question is, is my function the right way of going about things? i
just assumed that heavy recursion was ok and i have done some other heavy
functions in the past. or is there another way to make the function more efficient?


Sent through GMX FreeMail - http://www.gmx.net

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread