This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
You omitted to say what the answer was according to you and what the answer was according to XSLT and why you were right and XSLT was wrong.
Joined: Sep 14, 2009
Thanks for replay...
Actual result for the mod operation of 2100041810000023014509 digit (2100041810000023014509 mod 97) = 32
But, when i assign this value to variable (Lets say sum) and perform same operation ($sum mod 97), i am getting the result = 86
This wrong output is because of modulo operation on the integer number, which is larger than the data type range.
Now, I have written templates in XSL file which divides the input number in small segments and perform modulo operations on each segments.
Still, update me, if there is an easier method available in the XSL to perform same operation.
I didn't want to say that XSLT was "wrong" to come up with something else because I remember some complaints from way back when XSLT was first designed. My recollection was that people who tried to write transformers in a language other than Java claimed they were at a disadvantage because the spec said (essentially) that XSLT had to do arithmetic exactly as Java did it.
But now I can't find any evidence of that on the web. However, I'm pretty sure your theory about why XSLT gets the wrong answer for that calculation is right. Unfortunately I don't have any advice for you about how to get the right answer.