Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rules failing with schematronProcessingEngine="pure" #47

Closed
fviolette opened this issue Aug 1, 2017 · 17 comments
Closed

Rules failing with schematronProcessingEngine="pure" #47

fviolette opened this issue Aug 1, 2017 · 17 comments
Assignees
Milestone

Comments

@fviolette
Copy link

fviolette commented Aug 1, 2017

Hello,

Thanks for this lib!

The following assert/report expressions fail for me with the pure schematronProcessingEngine:

<sch:report test="node()[self::text()][matches(., '^\s')]" role="warning" sqf:fix="remove-leading-whitespace">
     The topic title must not start by a space.
</sch:report>
<sch:assert test="if (@xml:lang != 'en') then some $token in tokenize(base-uri(), '/') satisfies $token = @xml:lang else true()" role="fatal">
    The values of @xml:lang and the above language folder are not the same.
</sch:assert>
check.topic:
[schematron] Error in Schematron: [error] in PSAssertReport @ C:\git\documentati
on-dita\framework\rules\topic.sch Failed to compile XPath expression in <assert>
: 'if (@xml:lang != 'en') then some $token in tokenize(base-uri(), '/') satisfie
s $token = @xml:lang else true()' with the following variables: {} (javax.xml.xp
ath.XPathExpressionException: javax.xml.transform.TransformerException: Could no
t find function: if)
[schematron] Error in Schematron: [error] @ C:\git\documentation-dita\framework\
rules\topic.sch Error creating bound schema (java.lang.IllegalArgumentException:
 com.helger.schematron.pure.binding.SchematronBindException: Failed to precompil
e the supplied schema.)`

I haven't tested with schematron or xslt yet as per #45.

Thanks in advance for your support.

@phax phax self-assigned this Aug 1, 2017
@phax phax added the question label Aug 1, 2017
phax added a commit that referenced this issue Aug 1, 2017
@phax
Copy link
Owner

phax commented Aug 1, 2017

Hi Francois, I created a test file and it works without problems.
Is it possible, that you have Xalan in your classpath, and that takes precedence????

@fviolette
Copy link
Author

fviolette commented Aug 1, 2017

I don't think so but I will double-check tomorrow with a fresh test case.
I thought it could be XSLT1 vs 2 but my declarations seem OK.
For information, replacing matches with starts-with passed, though that's no longer the same test.

Will report - thanks.

phax added a commit that referenced this issue Aug 2, 2017
@fviolette
Copy link
Author

Obviously a classpath issue. It's solved now - the work can begin 👍

@fviolette
Copy link
Author

Reopening because I suspect I have a setup issue again: some more patterns with base-uri() don't pass on my side (with pure). When printing out the error message if I include <sch:value-of select="base-uri()"/> nothing returns, unlike in oXygenXML. All other expressions in above samples and other random XPath 2.0 as well (current-dateTime(), avg(), upper-case(), etc.) are fine. Do you have an idea?

@fviolette fviolette reopened this Aug 19, 2017
@fviolette
Copy link
Author

fviolette commented Aug 21, 2017

Investigating... could this be linked: https://sourceforge.net/p/saxon/mailman/saxon-help/thread/loom.20130530T132624-669%40post.gmane.org/ (cf. answer)?

If I make a dumb test:

<sch:assert test="resolve-uri('')">
    There is no Base URI
</sch:assert>

I get:

[schematron] Error in Schematron: [error] in PSAssertReport @ C:\test\topic.sch Failed to compile XPath expression in <as sert>: 'resolve-uri('')' with the following variables: {} (javax.xml.xpath.XPath ExpressionException: net.sf.saxon.trans.XPathException: Base URI {} is not an ab solute URI) [schematron] Error in Schematron: [error] @ C:\test\topic.sch Error creating bound schema (java.lang.IllegalArgumentExcep tion: com.helger.schematron.pure.binding.SchematronBindException: Failed to prec ompile the supplied schema.)

@phax
Copy link
Owner

phax commented Aug 21, 2017

base-uri() seems to be a very specific case :) I understand what goes wrong, but I couln't pinpoint this in the code so far. Will keep digging :)

@fviolette
Copy link
Author

Super thanks :)

@phax
Copy link
Owner

phax commented Aug 21, 2017

Saxon 9.7.0_18 HE, class DOMObjectModel.wrapOrUnwrapNode(Node node, Configuration config) explicitly passed "" as base URI - that kills us currently when using "pure" implementation. ... I will try to find a way around it

@fviolette
Copy link
Author

Will the next snapshot be enough to test the fix?

@phax
Copy link
Owner

phax commented Aug 22, 2017

Yes. Just noticed that the Travis build failed - on it. Sorry.

@fviolette
Copy link
Author

Oh don't! If that works, I am going to be the happiest man :-)

@phax
Copy link
Owner

phax commented Aug 22, 2017

SNAPSHOT -17 should (hopefully) do the trick. Hope to make you the happiest man :)

@fviolette
Copy link
Author

It seems that the base-uri() returned is the Schematron's.

<sch:assert test="some $token in tokenize(base-uri(), '/') satisfies $token = @xml:lang" role="fatal">
     The values of @xml:lang and the above language folder are not the same
     (<sch:value-of select="base-uri()"/>)
</sch:assert>
[schematron] [error] in /concept @ C:\git\documentation-dita\development\configuration\en\c-configure_sap_to_operate_with_rfc.dita The values of @xml:lang and the above language folder are not the same (file:/C:/git/documentation-dita/framework/rules/temp/topic.sch)

phax added a commit that referenced this issue Aug 22, 2017
@phax
Copy link
Owner

phax commented Aug 22, 2017

Sometimes I would appreciate if I would start thinking aforehead.... sigh

@fviolette
Copy link
Author

SNAPSHOT -18 seals the deal ✌️ !

@stefan-jung
Copy link

@fviolette, I've updated org.doctales.schematron to use SNAPSHOT 18.

@fviolette
Copy link
Author

Excellent - it's a long shot for me to use it, time to fix content issues ;-)
@phax Issue can be closed as far as I am concerned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants