|
RE: Data Structure Stack: msg#00164text.xml.saxon.help
You have to remember that all values in the XPath 2.0 data model are immutable, and this sometimes means that a different choice of algorithm is appropriate. You can certainly implement a stack in XSLT 2.0: <xsl:function name="stack:push" as="item()*> <xsl:param name="stack" as="item()*"/> <xsl:param name="item" as="item()"/> <xsl:sequence select="$stack, $item"/> </xsl:function> <xsl:function name="stack:pop" as="item()"> <xsl:param name="stack" as="item()*"/> <xsl:param name="item" as="item()"/> <xsl:sequence select="if (empty($stack)) then error(...) else $stack[position() != last()]"/> </xsl:function> P.S. General XSLT coding questions that are not specific to the Saxon product are better raised on the xsl-list at mulberrytech.com Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: saxon-help-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx > [mailto:saxon-help-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx] > On Behalf Of > Arthur Maloney > Sent: 23 June 2005 16:16 > To: saxon-help-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx > Subject: [saxon] Data Structure Stack > > Hello saxon-help, > > Stack - Well known data structure Last in First out (like a > stack of dishes at a buffet table) > > Is this doable in Xslt2/XPath2 > > consider SQL SELECT [firstName], [lastName] FROM Names > > push and pop [ ] and other code building constructs. > > > -- > 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 > _______________________________________________ > saxon-help mailing list > saxon-help-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx > https://lists.sourceforge.net/lists/listinfo/saxon-help > ------------------------------------------------------- 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> |
|---|---|---|
| Previous by Date: | RE: tinytree behaviour with document function: 00164, Michael Kay |
|---|---|
| Next by Date: | Re[2]: Data Structure Stack: 00164, Arthur Maloney |
| Previous by Thread: | Data Structure Stacki: 00164, Arthur Maloney |
| Next by Thread: | Re[2]: Data Structure Stack: 00164, Arthur Maloney |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |