phax / ph-schematron

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

Variable defined as an XPath location with a predicate causes a warning #175

Closed bertrand-lorentz closed 3 months ago

bertrand-lorentz commented 3 months ago

As I modify my schematron rules to make more use of variable, I've noticed that a variable defined as an XPath location with a predicate causes a warning: WARN com.helger.schematron.pure.xpath.XPathEvaluationHelper$SaxonEvaluator - Unknown Saxon expression type: net.sf.saxon.expr.FilterExpression

An example of such a variable would be: <let name="filterVar" value="/xml/car[@owner = 'o1']"/>

There's no problem when referencing this variable, as XPathEvaluationHelper.evaluateAsNodeList works and returns a node list.

Without the predicate [@owner = 'o1'], this would be a SlashExpression. And as you can't know what the predicate/filter does, I think it would be OK to handle FilterExpression the same way as SlashExpression: map it to NODESET.

I think I'm done modifying my schematron rules, so this should be the last issue on this topic from me 😃

phax commented 3 months ago

Thanks @bertrand-lorentz, as usual very helpful :) Links to #170 and #173

phax commented 3 months ago

Will be part of the upcoming 8.0.2 release