Calabash and Saxon-EE

<oXygen/> general issues.
jnicholas330
Posts: 2
Joined: Wed Feb 27, 2019 12:01 am

Calabash and Saxon-EE

Post by jnicholas330 » Fri Jul 31, 2020 4:57 pm

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.

Mircea
Posts: 77
Joined: Tue Mar 25, 2003 11:21 am

Re: Calabash and Saxon-EE

Post by Mircea » Mon Aug 03, 2020 3:50 pm

Hello,

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

Regards,
Mircea
Mircea Enachescu
<oXygen> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

jnicholas330
Posts: 2
Joined: Wed Feb 27, 2019 12:01 am

Re: Calabash and Saxon-EE

Post by jnicholas330 » Wed Aug 05, 2020 11:33 pm

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>


Mircea
Posts: 77
Joined: Tue Mar 25, 2003 11:21 am

Re: Calabash and Saxon-EE

Post by Mircea » Thu Aug 06, 2020 12:44 pm

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
Mircea Enachescu
<oXygen> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Post Reply