Skip to content

Software we use: Schematron

Michaela Iorga edited this page Feb 2, 2024 · 1 revision

Schematron

Schematron is an ISO specification for an XSLT-based domain-specific language to validate XML documents. It can perform complex logical ("business rule") validations that commonplace schema-based solutions (e.g. Relax NG, XML Schema) cannot.

You can use Schematron integrated into the OxygenXML IDE where it completes a compilation and transformation for you to build a report in the companion XML format for validation results, SVRL. If you wish to use Saxon or similar XSLT processor and not rely on a tool that embeds Schematron into an IDE, you will need to compile the Schematron into a XSLT and generate a result. Below is a diagram that visualizes this.

flowchart TD
    Source[validations.sch] --> Compile{{Saxon Engine and Schematron}} -->|Compile Schematron to XSLT| Build((validations.xsl))
    Validate[validate_me.xml] --> Transform{{Saxon Engine}}-->|Transform XML with XSL and generate results | Results((results.xml))
    Build --> Transform

In the above diagram, squares are source files you would keep in your project, hexagons are dependencies and libraries to perform a process described in the adjacent label, and circles are temporary files. You can store them with additional source files in your project, but that is not necessary (and we discourage that for OSCAL projects). By using a XSLT engine to take the XSLT stylesheet forms of compiled rules, you can generate results in a SVRL report. You can use them as an input for marked up content for human review or further process information by parsing the SVRL's XML format.