xsl-list
[Top] [All Lists]

RE: [xsl] RE : Re: [xsl] Complex recursion in XSLT 1.0

2008-02-21 07:55:41
One very minor observation: I think (though I would need to verify by
testing) that in Saxon this might perform better if you added elements at
the end rather than the start. In particular, this might allow the "new"
stack to share underlying space with the "old" stack in many cases, and to
avoid physical copying.

(I seem to be unusual in that I think of the top of the stack as being at
the high-address end. Comes from years of exposure to a hardware
architecture that worked that way.)

Michael Kay
http://www.saxonica.com/
 

-----Original Message-----
From: Florent Georges [mailto:lists(_at_)fgeorges(_dot_)org] 
Sent: 20 February 2008 15:50
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] RE : Re: [xsl] Complex recursion in XSLT 1.0

Mukul Gandhi wrote:

   Could you kindly demonstrate with a small code snippet, how to 
implement stack in a XSLT 2.0 stylesheet ...

    <xsl:function name="x:push" as="item()+">
       <xsl:param name="stack" as="item()*"/>
       <xsl:param name="item"  as="item()"/>
       <xsl:sequence select="$item, $stack"/>
    </xsl:function>

    <xsl:function name="x:pop" as="item()*">
       <xsl:param name="stack" as="item()*"/>
       <xsl:sequence select="remove($stack, 1)"/>
    </xsl:function>

    <xsl:function name="x:top" as="item()?">
       <xsl:param name="stack" as="item()*"/>
       <xsl:sequence select="$stack[1]"/>
    </xsl:function>

  :-)

  That's just an idea, you might want to control more 
precisely errors (what if one pops an empty stack?, etc.)

  Regards,

--drkm






















      
______________________________________________________________
_______________
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails 
vers Yahoo! Mail http://mail.yahoo.fr


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



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