The table below lists all the
schematron built-in
functions (in this namespace:
http://marklogic.com/xdmp/schematron
).
The schematron library manages the Schematron feature in MarkLogic to validate your XML and JSON documents against schemas. Schematron is a rule based validation language expressed in XML that uses XPath to make assertions about the presence or absence of patterns in XML trees.
Schematron is an open source project on Github and licensed under MIT. MarkLogic supports the latest version of Schematron, called the "skeleton" XSLT implementation of ISO Schematron. The APIs described here enable you to use Schematron on MarkLogic to validate XML and JSON data.
The open source XSLT based Schematron implementation can be found at:
https://github.com/Schematron/schematron
To use schematron library module functions in your JavaScript code,
include a require
statement similar to the following in
your code:
const schematron = require("/MarkLogic/schematron/schematron.xqy");
Function name | Description |
---|---|
schematron.compile | This function compiles the Schematron schema. |
schematron.delete | This function deletes the Schematron schema from the schema database and, if found, the validator XSLT from the modules database. |
schematron.get | This function returns the validator XSLT from the modules database. |
schematron.put | This function compiles the Schematron schema with $schematron-uri as the URI of the Schematron document in the schema database and inserts the generated validator XSLT in the modules database with the URI, {$schematron-uri}-validator.xsl. |
schematron.validate | This function accepts the document to be validated and the validator XSLT and returns the output of the validation in SVRL (Schematron Validation Report Language) format, which is a simple XML based language used to report the results of Schematron validation. |