xsl-list
[Top] [All Lists]

Re: Name function in XSL

2003-05-08 00:57:16
You could make the tempalte like this

<xsl:template name="ele-to-att">
  <xsl:param name="nodeset" />
     ... do work on the top node
         ... if it has no children do work on the next node ...
         ... else ...
            <xsl:call-template name="ele-to-att">
              <xsl:with-param select="./*" />
            </xsl:call-template>
    ... go to next node ...
</xsl:template>

It's not the best way to do recursion, as tail recursion is the better
option (although there are only a few transformers that support it so it
doesn'T really matter) but you really need to try to keep the recurssion
tight to stop any bad run time errors.

Cheers

Simon

----- Original Message -----
From: "Molnar Agnes" <agi(_at_)harpia(_dot_)homeip(_dot_)net>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Thursday, May 08, 2003 10:59 AM
Subject: Re: [xsl] Name function in XSL



So it's work, but I have an other question.
I'd like if this work recursively, so if I have an XLM document with more
deep, how can I do this?

Thanks again,
Agnes



 Molnár Ágnes
-----------------------
 Web: http://aghy.uw.hu
 Icq: 167290967
 Tel: +36-20-212-8493


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



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



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