phax / ph-schematron

Java Schematron library that supports XSLT and native application
Apache License 2.0
115 stars 36 forks source link

schxlst: Unable to use schematron with include #116

Closed francogu closed 2 years ago

francogu commented 3 years ago

Hello,

Version is 6.0.3

I tried to use the schxslt version to compare over the pure and xslt version. When trying to apply the validation. Seems it was not able to load schematron sub-files that are included in the main file.

The folder schematron is not a folder in classpath and contains entry-xslt2.sch and the related included files at the same level (stage-1.sch, stage-2.sch etc...)

final SchematronResourceSchXslt_XSLT2 schematronResourceSchXsltXslt2 = new SchematronResourceSchXslt_XSLT2(new FileSystemResource("schematron/entry-xslt2.sch"));
final Document document = schematronResourceSchXsltXslt2.applySchematronValidation(new StreamSource(xmlToValidate));

It outputs the following log:

01/02/2021 - 14:40:47.939 WARN c.h.c.url.URLHelper - Failed to open input stream for 'jar:file:/tools/maven/repository/name/dmaus/schxslt/schxslt/1.6.2/schxslt-1.6.2.jar!/xslt/2.0/file:/git/myproject/schematron/stage-1.sch': java.io.FileNotFoundException - JAR entry xslt/2.0/file:/git/myproject/schematron/stage-1.sch not found in /tools/maven/repository/name/dmaus/schxslt/schxslt/1.6.2/schxslt-1.6.2.jar 01/02/2021 - 14:40:48.065 WARN c.h.c.url.URLHelper - Failed to open input stream for 'jar:file:/tools/maven/repository/name/dmaus/schxslt/schxslt/1.6.2/schxslt-1.6.2.jar!/xslt/2.0/file:/git/myproject/schematron/stage-2.sch': java.io.FileNotFoundException - JAR entry xslt/2.0/file:/git/myproject/schematron/stage-2.sch not found in /tools/maven/repository/name/dmaus/schxslt/schxslt/1.6.2/schxslt-1.6.2.jar 01/02/2021 - 14:40:48.171 WARN c.h.c.url.URLHelper - Failed to open input stream for 'jar:file:/tools/maven/repository/name/dmaus/schxslt/schxslt/1.6.2/schxslt-1.6.2.jar!/xslt/2.0/file:/git/myproject/schematron/stage-3.sch': java.io.FileNotFoundException - JAR entry xslt/2.0/file:/git/myproject/schematron/stage-3.sch not found in /tools/maven/repository/name/dmaus/schxslt/schxslt/1.6.2/schxslt-1.6.2.jar 01/02/2021 - 14:40:48.176 WARN c.h.c.url.URLHelper - Failed to open input stream for 'jar:file:/tools/maven/repository/name/dmaus/schxslt/schxslt/1.6.2/schxslt-1.6.2.jar!/xslt/2.0/file:/git/myproject/schematron/stage-4.sch': java.io.FileNotFoundException - JAR entry xslt/2.0/file:/git/myproject/schematron/stage-4.sch not found in /tools/maven/repository/name/dmaus/schxslt/schxslt/1.6.2/schxslt-1.6.2.jar

Then it seems to be stuck as it seems to make endless call to method net.sf.saxon.dom.DOMNodeWrapper.skipFollowingTextNodes

Do you have any guidance to get rid of the issue except merging all schematron file in a single big one ?

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

phax commented 3 years ago

@francogu please try again with th latest version 6.2.2 - it seems like schxslt managed to get the includes working correctly...