hi, I am trying to validate international bank account number in DataPower, below is the xslt 2.0 code which does it, but DataPower is not supporting some of these xslt2.0 functions, can anyone suggest on how we can achieve this in the DataPower?
Internationl Bank Account Number validation details:
- Check that the total IBAN length is correct as per the country. If not, the IBAN is invalid
- Move the four initial characters to the end of the string
- Replace each letter in the string with two digits, thereby expanding the string, where A = 10, B = 11, ..., Z = 35
- Interpret the string as a decimal integer and compute the remainder of that number on division by 97
<xsl:stylesheet version="2.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"xmlns:xs="http://www.w3.org/2001/XMLSchema"xmlns:local="http://localhost/"><xsl:template match="IBAN[local:validate(.)]"><xsl:text>Validated IBAN</xsl:text></xsl:template><xsl:function name="local:validate"><xsl:param name="pIBAN" as="xs:string"/><xsl:sequence select="xs:integer(codepoints-to-string(for $n in string-to-codepoints(concat(substring($pIBAN,5),substring($pIBAN,1,4)))return if ($n > 64)then string-to-codepoints(string($n - 55))else $n)) mod 97 eq 1"/></xsl:function></xsl:stylesheet>