qiuwei / jing-trang

Automatically exported from code.google.com/p/jing-trang
Other
1 stars 1 forks source link

Schematron validation fails with the latest Saxon 9 #136

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
If Saxon Home Edition is used then the Schematron stylesheet fails as it uses 
Saxon standard extension functions that are supported only in the PE or EE 
editions:
Error on line 334 
  XTDE1425: Cannot find a matching 0-argument function named
  {http://saxon.sf.net/}column-number(). The namespace URI and local name are recognized,
  but the number of arguments is wrong
  at xsl:call-template name="location" (#104)
  at xsl:for-each (#99)
     processing /schema/pattern[1]/rule[1]
  at xsl:for-each (#96)
     processing /schema/pattern[1]
  at xsl:call-template name="process-patterns" (#79)
  at xsl:call-template name="process-phase" (#58)
  in built-in template rule
:334: fatal: Cannot find a matching 0-argument function named 
{http://saxon.sf.net/}column-number(). The namespace URI and local name are 
recognized, but the number of arguments is wrong

If a license key is added then Saxon gives a strange error message, suggesting 
possibly a configuration problem:

Exception in thread "main" java.lang.IllegalArgumentException: Unknown XPath 
version 0
    at com.saxonica.config.ProfessionalConfiguration.newExpressionParser(ProfessionalConfiguration.java:592)
    at com.saxonica.config.EnterpriseConfiguration.newExpressionParser(EnterpriseConfiguration.java:956)
    at net.sf.saxon.expr.ExpressionTool.make(ExpressionTool.java:72)
    at net.sf.saxon.style.StyleElement.makeExpression(StyleElement.java:519)
    at net.sf.saxon.style.XSLApplyTemplates.prepareAttributes(XSLApplyTemplates.java:86)
    at net.sf.saxon.style.StyleElement.processAttributes(StyleElement.java:419)
    at net.sf.saxon.style.StyleElement.processAllAttributes(StyleElement.java:368)
    at net.sf.saxon.style.StyleElement.processAllAttributes(StyleElement.java:376)
    at net.sf.saxon.style.StyleElement.processAllAttributes(StyleElement.java:376)
    at net.sf.saxon.style.PrincipalStylesheetModule.processAllAttributes(PrincipalStylesheetModule.java:303)
    at net.sf.saxon.style.PrincipalStylesheetModule.preprocess(PrincipalStylesheetModule.java:221)
    at net.sf.saxon.PreparedStylesheet.setStylesheetDocument(PreparedStylesheet.java:340)
    at net.sf.saxon.TemplatesHandlerImpl.getTemplates(TemplatesHandlerImpl.java:90)
    at com.thaiopensource.validate.schematron.SchemaReaderImpl.createSchema(SchemaReaderImpl.java:379)
    at com.thaiopensource.validate.auto.SchemaReaderSchemaReceiver$1.reparse(SchemaReaderSchemaReceiver.java:25)
    at com.thaiopensource.validate.auto.AutoSchemaReader.createSchema(AutoSchemaReader.java:75)
    at com.thaiopensource.validate.ValidationDriver.loadSchema(ValidationDriver.java:126)
    at com.thaiopensource.relaxng.util.Driver.doMain(Driver.java:142)
    at com.thaiopensource.relaxng.util.Driver.main(Driver.java:35)

As the first provider for Schematron is the one based on the new Saxon then if 
this is in the classpath then the Schematron validation will fail although it 
should well work if some other provider will be used.

The best solution probably will be to create integrated extension functions for 
Saxon HE equivalent with the ones used now and make sure we use Saxon at Home 
Edition level. 
In any case the new Saxon provider should fail nicely if it cannot handle the 
Schematron validation for whatever reasons and allow one of the other ones to 
be used instead.

Original issue reported on code.google.com by georgebina76 on 11 Feb 2011 at 8:45

GoogleCodeExporter commented 8 years ago
Fixed in r2356. Updated Saxon 9 to the latest 9.3.0.4 HE release and applied a 
workaround suggested by Mike Kay on the saxon-user list to avoid the "Unknown 
XPath version 0" exception.

Original comment by georgebina76 on 28 Feb 2011 at 10:11