I need to validate some XMLs with schematrons http://cpe.sunat.gob.pe/sites/default/files/inline-images/Reglas%20de%20Validaci%C3%B3n.zip which use EXSLT. I've used Xalan Apache and SaxonHE as well, but those don't work because schematrons are using regexp:match and I really have a problem validating XMLs with those schematron which contains regular expression, for instance:
<xsl:if test="./cbc:ID/@schemeID ='02' and not(regexp:match(./cbc:ID,'^[F][A-Z0-9]{3}-[0-9]{1,8}$|^(E001)-[0-9]{1,8}$|^[0-9]{1,4}-[0-9]{1,8}$'))">
The code for EXSLT is available on github https://github.com/bzerangue/exslt.org
My question is if there is a way to validate XMLs with those schematrons using java or javascript.
Please help me!
Saxon 9 HE is an XSLT 2.0 processor so it supports the XSLT and XPath functions using regular expressions, like https://www.w3.org/TR/xpath-functions/#func-matches. You should be able to replace the use of e.g. not(regexp:match(./cbc:ID,'^[F][A-Z0-9]{3}-[0-9]{1,8}$|^(E001)-[0-9]{1,8}$|^[0-9]{1,4}-[0-9]{1,8}$'))
with not(matches(cbc:ID,'^[F][A-Z0-9]{3}-[0-9]{1,8}$|^(E001)-[0-9]{1,8}$|^[0-9]{1,4}-[0-9]{1,8}$'))
.