Name
p:validate-with-schematron — The standard p:validate-with-schematron step.
Synopsis
The p:validate-with-schematron step applies
Schematron
processing to the source document.
| Input port | Primary | Sequence | Content types |
|---|---|---|---|
| source | ✔ | xml html | |
| schema | xml |
| Output port | Primary | Sequence | Content types |
|---|---|---|---|
| result | ✔ | xml html | |
| report | ✔ | xml json |
| Option name | Type | Default value |
|---|---|---|
| assert-valid | xs:boolean | true() |
| parameters | map(xs:QName,item()*)? | () |
| phase | xs:string | '#DEFAULT' |
| report-format | xs:string | 'svrl' |
Declaration
1 |<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" type="p:validate-with-schematron">
| <p:input port="source" primary="true" content-types="xml html"/>
| <p:input port="schema" content-types="xml"/>
| <p:output port="result" primary="true" content-types="xml html"/>
5 | <p:output port="report" sequence="true" content-types="xml json"/>
| <p:option name="parameters" as="map(xs:QName,item()*)?"/>
| <p:option name="phase" select="'#DEFAULT'" as="xs:string"/>
| <p:option name="assert-valid" select="true()" as="xs:boolean"/>
| <p:option name="report-format" select="'svrl'" as="xs:string"/>
10 |</p:declare-step>Errors
| Code | Description |
|---|---|
err:XC0054 | It is a dynamic error (err:XC0054)
if the assert-valid option is true
and any Schematron assertions fail. |
err:XC0151 | It is a dynamic error (err:XC0151)
if the document supplied on schema port is not a valid Schematron
document. |
Implementation defined features
- How the Schematron implementation is selected is implementation-defined.
- The list of supported Schematron implementations and their associated values is implementation-defined.
- Which parameters the
c:compilemap supports for a given Schematron implementation is implementation-defined. - Which parameters this conversion from native reporting format to XVRL supports is implementation-defined.
Description
The p:validate-with-schematron step is a
standard XProc 3.1 step.
It is also described on XProcRef.org.
Schematron is implemented with SchXslt2 version 1.10.3.
If validation errors occur and there are no line numbers in the reported errors, make sure that the line numbering feature is enabled globally in the configuration or when the validated document is loaded.
SVRL to XVRL conversion
The SchXslt2 processor produces SVRL (Schematron Validation Reporting Language) output. XML Calabash will convert this to XVRL (Extensible Validation Report Language) if that output format is requested. The goal of XVRL is provide a unified vocabulary for error reporting across a wide range of validation technologies (DTDs, RELAX NG, Schematron, etc.).
The XVRL specification describes several parameters that can be specified to control various aspects of this conversion:
xvrl:default-severityIf an assertion does not specify a severity, this default severity will be used (except on
svrl:successful-reportelements where the default value “info” is always used). Starting with XML Calabash version 3.0.43, both theseverityandroleattributes are inspected for a severity value (earlier versions only looked at theroleattribute). You can map other attributes with themap-to-severityparameter.xvrl:serialization-formatThe only value accepted is “
xml”.xvrl:languageAllows the caller to filter localized messages. If the validation report provides messages in more than one language, the XVRL report will only contain messages in the specfied language. If more than one language is provided, messages in the first matching language are returned.
map-to-severityXML Calabash assumes that the severity of an assertion is reported in the
roleorseverityattribute. If themap-to-severityparameter is provided, it must be a list of QNames. Each QName is considered in turn and the value of the first attribute with a matching QName is taken as the severity.xpath-notationThis parameter is not supported.
The XVRL parameters can be provided directly in the parameters map
or in a map named c:xvrl in the parameters.
Additional examples
The XProc test suite contains examples of the p:validate-with-schematron step.