Remove value in string/cookie based on position()?
I am building a simple eComerce solution where the basket is populated via nodeId's in a cookie (comma seperated).
So i could have a value of a cookie looking like this; "1112,1113,1112".
In the cart there is an option for deleting an item/node. But how do i do this? The note needs to be deleted based on the position() and not the actual @id as there could more than one with the same @id.
Hm, maybe not an answer to your question, but why don't you use a user control to handle all this stuff. I see far too many things xslt isn't designed for in your script (I'd only focus on presenting data instead of manipulating stuff through xslt - although personal preference...).
I am aware that a usercontrol maybe would be better in some aspects - but this is alos sort of an experiment and a learning project, so i would like to do it in xslt :)
I have now figured out that if i instead of passing values with comma (,) pass values with periods (.) the sum function i stated above works as intended.
Remove value in string/cookie based on position()?
I am building a simple eComerce solution where the basket is populated via nodeId's in a cookie (comma seperated).
So i could have a value of a cookie looking like this; "1112,1113,1112".
In the cart there is an option for deleting an item/node. But how do i do this? The note needs to be deleted based on the position() and not the actual @id as there could more than one with the same @id.
The code looks like this;
Also; how can i sum up the total price of all the selected nodes/price and use it in the bottom sum outside the loop?
:-)
Hm, maybe not an answer to your question, but why don't you use a user control to handle all this stuff. I see far too many things xslt isn't designed for in your script (I'd only focus on presenting data instead of manipulating stuff through xslt - although personal preference...).
Hope this helps.
Regards,
/Dirk
I am aware that a usercontrol maybe would be better in some aspects - but this is alos sort of an experiment and a learning project, so i would like to do it in xslt :)
Variables in XSLT are immutable, so the thing to do would probably be something like this:
Works like a charm - thanks :)
The final thing is to sum the price of every line. I have tried with the following but cannot get it to work;
The above line just returns NaN - am i totally off course in the assumption that something along the lines of the above should work?
Is your price formatted with comma or periods? The parser might not be able to figure out that the string is a number.
You could also try number()
Dan
The 'price' fields contains comma values. How would i incorporate the Number() function in my one-line statement?
I have now figured out that if i instead of passing values with comma (,) pass values with periods (.) the sum function i stated above works as intended.
is working on a reply...