我正在针对XSL验证XML文件(我不想修改XSL),但是我收到了这个错误:
错误:
ValFactura.xsl第35行出错:XTDE1425:无法找到匹配项 1参数函数命名 内置模板中的{http://www.datapower.com/extensions}变量() 规则
JAVA代码:
try {
OutputStream os = new PrintStream(System.out);
xsl.process(xmlFile, xslFile, os);
}
catch (TransformerException e) {
e.printStackTrace();
}
private void process(Source xml, Source xsl, Result result) throws TransformerException {
try {
Templates template = factory.newTemplates(xsl);
Transformer transformer = template.newTransformer();
transformer.transform(xml, result);
} catch (TransformerConfigurationException tce) {
throw new TransformerException(tce.getMessageAndLocation());
} catch (TransformerException te) {
throw new TransformerException(te.getMessageAndLocation());
}
}
XSL提取:
<xsl:stylesheet xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:regexp="http://exslt.org/regular-expressions"
xmlns:func="http://exslt.org/functions"
xmlns:dp="http://www.datapower.com/extensions"
extension-element-prefixes="dp" exclude-result-prefixes="dp"
version="1.0">
....
<xsl:variable name="numeroRuc" select="substring(dp:variable('var://context/cpe/nombreArchivoEnviado'), 1, 11)"/>
....
</xsl:stylesheet>
Maven图书馆:
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
<version>9.5.1-5</version>
</dependency>
有什么想法吗?
非常感谢你的帮助!
PS:对不起,我的英文不好:=)