logo       

Re[2]: Data Structure Stack: msg#00165

text.xml.saxon.help

Subject: Re[2]: Data Structure Stack

Hello Michael,

Friday, June 24, 2005, 9:16:36 AM, you wrote:

MK> You have to remember that all values in the XPath 2.0 data model are
MK> immutable, and this sometimes means that a different choice of algorithm is
MK> appropriate.

MK> You can certainly implement a stack in XSLT 2.0:

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

MK> <xsl:function name="stack:pop" as="item()">
MK> <xsl:param name="stack" as="item()*"/>
MK> <xsl:param name="item" as="item()"/>
MK> <xsl:sequence select="if (empty($stack))
MK> then error(...)
MK> else $stack[position() != last()]"/>
MK> </xsl:function>

MK> P.S. General XSLT coding questions that are not specific to the Saxon
MK> product are better raised on the xsl-list at mulberrytech.com

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

Thanks, very useful. I hadn't noticed, in future I will keep to the general list
For the time being I do not wish to confuse myself with Java grammar
So I'm content with your books and C#.
At some point its highly likely that I will buy your product.



--
Best regards,
Arthur
mailto:ArthurM-1x2qwuXUxR3QT0dZR+AlfA@xxxxxxxxxxxxxxxx



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise