Subject: Re: [xsl] RE : Re: [xsl] Complex recursion in XSLT 1.0 From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx> Date: Thu, 21 Feb 2008 17:38:18 +0530 |
I agree to all your points. The functional nature of XPath is more important than desiring a modifiable Stack. I am sure, we can leverage the Stack implementation concept you gave for practical applications. On Thu, Feb 21, 2008 at 12:31 AM, Florent Georges <lists@xxxxxxxxxxxx> wrote: > 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 -- Regards, Mukul Gandhi
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] RE : Re: [xsl] Complex re, Florent Georges | Thread | RE: [xsl] RE : Re: [xsl] Complex re, Michael Kay |
Re: [xsl] [XSL] read java variable , Zulfikar Dholkawala | Date | Re: [xsl] [XSL] read java variable , Florent Georges |
Month |