You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 2, 2020. It is now read-only.
I have been battling for a while now with a schematron rule that does not seem to evaluate my variable correctly leaving me with no correct match.
My example and rule should always fail the assertion, and write out the message (as a "Test") ... as I want one question for every one reference (and visa versa) ... but the count always comes up as ZERO!
My output when rendering outputs the variables correctly:
Question::Count:[[question/@id=[GUID-12345] has [0] references with reference/@href=[#GUID-ABCDEFG/GUID-12345]
As you can see, zero, when it should find 1 match.
If I count "all" the references, then it DOES give me 2!
Now, if I hard-code the count as a string: <value-of select="count(ancestor::parent//reference[@href eq '#GUID-ABCDEFG/GUID-12345'])" />
Then I do get the correct count/result!!
On another strange note: If I put a syntax error in my rule, the exception that is thrown shows me the "content" of the variable, not the value:
question/@id=[GUID-12345] has [1] references with reference/@href=[#GUID-ABCDEFG/GUID-12345])
question/@id=[GUID-67890] has [1] references with reference/@href=[#GUID-ABCDEFG/GUID-67890])
About your exception: when the code is buggy there exists no value because the resulting script is not even being executed. Not sure what you expected here?
Hi Patrik,
Thank-you for your reply and confirmation that it does work for you! It must be the version that I am using that does not work. I am using a .Net version (so also perhaps not the right area to have posted my question as well - so my apology for that!)
If I update my schema as you have it with the correct bindings, I get an error within the API: {The value of the 'queryBinding' attribute ('xslt2') is not valid.}
So clearly not using the "better" version of Schematron perhaps.
Can you please, point me in a direction for a .Net API version of Schematron that is functional, so that I may replace the one that I have perhaps?
I have been battling for a while now with a schematron rule that does not seem to evaluate my variable correctly leaving me with no correct match.
My example and rule should always fail the assertion, and write out the message (as a "Test") ... as I want one question for every one reference (and visa versa) ... but the count always comes up as ZERO!
Where my rule is as follows:
My input XML is as follows:
My output when rendering outputs the variables correctly:
As you can see, zero, when it should find 1 match.
If I count "all" the references, then it DOES give me 2!
Now, if I hard-code the count as a string:
<value-of select="count(ancestor::parent//reference[@href eq '#GUID-ABCDEFG/GUID-12345'])" />
Then I do get the correct count/result!!
On another strange note: If I put a syntax error in my rule, the exception that is thrown shows me the "content" of the variable, not the value:
count(ancestor::question//data-about[@href eq concat('#', ancestor::question/@id, '/', .))])': syntax error, expecting ','
The text was updated successfully, but these errors were encountered: