[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: RE : Re: Complex recursion in XSLT 1.0

Subject: Re: RE : Re: Complex recursion in XSLT 1.0
From: Florent Georges <lists@xxxxxxxxxxxx>
Date: Wed, 20 Feb 2008 20:01:57 +0100 (CET)
Re:  RE : Re:  Complex recursion in XSLT 1.0
Mukul Gandhi wrote:

> 1) On this line <!-- 2. --> , I create a variable
> 'stack'. This is a new *variable* and not the old one (on
> line <!-- 1. -->; because we cannot modify variables in
> XSLT). This doesn't make me quite happy :)

  Why?  I know you know the functional nature of XPath.
Say you have a function that sums two numbers, would you
expect that using it as in "x:add($v, 1)" the variable was
modified?  Or just that the result of the addition to be
returned as the value of the function?

  Dealing with stacks or whatever is not different.  Values
are not modifiable.  But you can build new value, possibly
refering to other one.  And you can bind values to
variables.  You can't modify stacks themselves.  But from
existing stacks, you can builds new one with for instance
the first value dropped, or with an extra value in front.

> 2) On line <!-- 6. -->, I do x:top(x:pop($stack)). This
> modifies a transient stack, and doesn't modify the
> variable $stack.

  Well, regarding the spec, a new sequence is created as the
value of the function pop with param $stack.  This is the
value of the function remove with params $stack and 1.  This
value is then used by the function top to build a new value
(a sequence of one or zero item, the first of the param).

  The sequence bound to $stack is not modified.  And neither
the intermediate sequences are (well, the observable
behaviour is that no sequence can not be modified).

> I would like the variable $stack to be modified. But
> that's not possible, we know :)

  Are you really sure you want that ?-)

> I guess, these limitations will prohibit some stack
> specific programs to be built.

> Can we think of some strategies to overcome these
> limitations.

  I wonder what is a limitation for something called a stack
and that allows you to push items, pop them and look at its
top :-)

  Regards,

--drkm



















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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.