Subject:variable increment Author:Tony Lavinio Date:01 Apr 2005 10:02 AM
Variables in XSLT and XQuery don't vary after definition,
similarly to how variables act in algebra.
Perhaps if you told us what you were trying to accomplish
we could help.
Subject:variable increment Author:(Deleted User) Date:01 Apr 2005 10:03 AM
Unfortunately XSLT cannot change the value of a variable like a procedural
language does, but you can simulate this by invoking a named template
passing a parameter computed using an expression like "$varName+1".
If this is not what you meant, please give us more details about what you
want to do.
Subject:variable increment Author:Sean Vengan Date:11 May 2005 01:26 AM
Hi,
This is actually what I am trying to do can you please explain.
ie I have a global variable which I declare outside a for loop to loop through the values.
What i'd like to do is populate the global variable with the running total. This will give me a summed total when the loop has finished. NOTE: I have to be selective when I loop though i.e I can't just use the sum of ALL nodes.
Although saxon:assign is available, it is really not a good
idea to use it. There is nothing that can be done with saxon:assign
that cannot be done with XSLT 2.0 and not using it.
XSLT is a functional language, and it requires a different way of
thinking about problems. The assumptions of the language are that
variables are like they are in algebra, in that they are symbols for
values, and not "buckets" which can hold any old value at any time.
Using saxon:assign is working against the language.
That being said, if you do want to use it, you might want to ask on
the saxon-help mail list at SourceForge or the xsllist at Mulberry
Technologies. But most likely in either case, they will recommend
against using it.