[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
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|