This content has been marked as final. Show 9 replies
To declare a variable named 'xxx' use the following syntax
<?xdoxslt:set_variable($_XDOCTX, 'xxx', 0)?>
This will declare the variable 'xxx' and assign it a value 0
To change the value of the variable use
<?xdoxslt:set_variable($_XDOCTX, 'xxx', 1)?>
To retrieve the value to the variable use
<?xdoxslt:get_variable($_XDOCTX, 'xxx') ?>
The value of the variable can be compared with some value as follows
<?if: xdoxslt:get_variable($_XDOCTX, 'xxx') =0?>
Hi Chris and Brown,
I am trying to summate a list of values indeed, but the list is in a group.
So if I want to summate the list I must use: <?sum(current-group()/ELEMENT)?>.
But both of your replies will help me out.
@Tim: Sometimes the list is as following: null, null, null, 0 --> if that happens I want to see a 0 if the list is null, null, null, null then I want to see nothing
@Chris: I don't get any NaN errors when I use <?sum(current-group()/ELEMENT)?>
But when I am using <?xslt:sum(current-group()/ELEMENT)?> I will get a error. Only when I choose tools -> validate it says there are no errors, but when I request a preview it returns an error without any details.
Could you count the number of elements, compare it to the count of the number of elements that are null, if they are the same then output null otherwise output the sum.
Something like ( haven't tested it...)
hope it helps