I have the requirement to do the modulo operation in XSLT1.0. But, it’s not returning expected result which is working fine in Java.
XSLT1.0:
Input:
<xsl:variable name="num2" select="'501108006111600075131466'"/>
<xsl:variable name="num3" select="'3214282912345698765432161182'"/>
<xsl:value-of select="$num2 mod 97"/>
<xsl:value-of select="$num3 mod 97"/>
Output:
82
65
Java
Input
StringBuilder numeric = new StringBuilder();
numeric.append(501108006111600075131466);//Input1
//numeric.append(3214282912345698765432161182);//Input2
BigInteger nt = new BigInteger(numeric.toString());
return nt.mod(BigInteger.valueOf(97)).intValue() == 1;
Output
true
true
In Java, returned expected result but in XSLT1.0 it’s not return exact output. Is there any other way to implement mod operator in XSLT1.0?