Page 1 of 1

Calabash and Saxon-EE

Posted: Fri Jul 31, 2020 4:57 pm
by jnicholas330
I'm trying to run a XProc that needs to use schema-aware functions during a p:validate-with-schematron step. This schematron file works fine within Oxygen (i.e. it fires the rules as expected using *validate with*). However, when running as part of an XProc transformation, those rules do not fire (from svrl report). I assume this is because Calabash is being invoked using the wrong version of Saxon or the wrong flags, but I can't see where this can be configured in the tool. I'm running 22.1.

Re: Calabash and Saxon-EE

Posted: Mon Aug 03, 2020 3:50 pm
by Mircea
Hello,

Can you please give us a small example in order to investigate?

Regards,
Mircea

Re: Calabash and Saxon-EE

Posted: Wed Aug 05, 2020 11:33 pm
by jnicholas330
err.xml

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<n1:ElectionReport xmlns:n1="NIST_V2_election_results_reporting.xsd">
	<n1:Format>summary-contest</n1:Format>
	<n1:GeneratedDate>2001-12-17T09:30:47Z</n1:GeneratedDate>
	<n1:Issuer>String</n1:Issuer>
	<n1:IssuerAbbreviation>String</n1:IssuerAbbreviation>
	<n1:SequenceStart>0</n1:SequenceStart>
	<n1:SequenceEnd>0</n1:SequenceEnd>
	<n1:Status>correction</n1:Status>
	<n1:VendorApplicationId>String</n1:VendorApplicationId>
</n1:ElectionReport>
err.sch

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2"
    xmlns:sqf="http://www.schematron-quickfix.com/validator/process"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <sch:ns uri="NIST_V2_election_results_reporting.xsd" prefix="cdf"/>
    <sch:ns uri="http://www.w3.org/2001/XMLSchema-instance" prefix="xsi"/>
    <xsl:import-schema namespace="NIST_V2_election_results_reporting.xsd"
        schema-location="https://raw.githubusercontent.com/usnistgov/ElectionResultsReporting/829995caa5e174038eb89aefd098d449acbdbd99/NIST_V2_election_results_reporting.xsd"/>
    <sch:pattern>
        <sch:rule context="element(*, cdf:ElectionReport)">
            <sch:assert test="false()">Assert Run</sch:assert>
        </sch:rule>
    </sch:pattern>
</sch:schema>
err.xpl

Code: Select all

<p:declare-step version="1.0" name="n1" psvi-required="false" xmlns:p="http://www.w3.org/ns/xproc">
  <p:input port="source" kind="document" primary="true" sequence="false">
    <p:document href="err.xml"/>
  </p:input>
  <p:output port="result" primary="true" sequence="false">
    <p:pipe step="n1.1" port="report"/>
  </p:output>
  <p:validate-with-schematron name="n1.1">
    <p:input port="parameters">
      <p:empty/>
    </p:input>
    <p:input port="source">
      <p:pipe step="n1" port="source"/>
    </p:input>
    <p:input port="schema">
      <p:document href="err.sch"/>
    </p:input>
    <p:with-option name="assert-valid" select="'false'"/>
  </p:validate-with-schematron>
  <p:sink name="n1.2">
    <p:input port="source">
      <p:pipe step="n1.1" port="result"/>
    </p:input>
  </p:sink>
</p:declare-step>


Re: Calabash and Saxon-EE

Posted: Thu Aug 06, 2020 12:44 pm
by Mircea
Hello Nicholas,

I changed the Schematron rule's context like:

Code: Select all

<sch:rule context="cdf:ElectionReport">
and the XProc transformation works as expected.
It seems that the "element(*, $type)" function does not work well when the Schematron is called from an XProc step.
We will investigate this toghether with the Calabash team.

Regards,
Mircea