diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..befb626 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +dist/ +test/result/*.xml +*.xpr +.notes.txt diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..f5c198f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,47 @@ +notifications: + email: false +language: java +jdk: +- openjdk8 +addons: + apt: + packages: + - libxml2-utils +services: +- docker +env: +- img=existdb/existdb:4.7.1 +- img=evolvedbinary/exist-db:eXist-3.6.1-minimal +jobs: + include: + - stage: GitHub Release + before_install: skip + before_script: skip + script: skip + after_success: skip + deploy: + provider: releases + token: + secure: CmdGlijuVza6Sxp7SBb0A9xuLPX24MJoFZeZF25T/8OlWBf4LeQ7lQnQgeThfuto+iOGlleNPm/641n1Cm+9Qb95AJA9G06R/7aBw7wkVGC34fNiDODnkor/UalB//uwlGjvg8oMR0OYMhQDqJVfz+HgyxCmdy297abt9iV/t7lMsP7rctMKUvRkXgntGwSP8LrNqo9bocZV0SgE3x2nzgMId0o9mirR+yeAPvPGqaE7aJcl5hbh51JGwSVUi5xNBNW3tI0ztFdbrX1u8rGY74hEUkL93ZEicu8wwttU8cTeBOSSWF2TpRWyVRbrqhAwvklhOtnk+RQm72TaUp41ibN+t+t1FVMq2Ae5CUh+X2ZoLXuw7FDw4HmeQR4mNyVlToDlTgG4r0iZVEjIx7JFOZ1xXTb21I6fDeaJG2EvUQ7XtHUkJRHucWohwliImRQoklUOy1b/q/8iIxBrcukC9Zx2f8Sae8zKyBWW6m4Z8qAerV1W3euP/R3wcchJ/gtdUxTM5bF+r6OdmoywjEd7Wu1Yvcp0EW7IcUCTni0PQQbOsJ4ii7qvNNOqNCpibLmtzKQPLm4/GLYp2LHKTTlmEUmQWc7Ko5lXCEr7j0Adtl5dIa8+zNG4Seiwu8fSy3VwbrhL4EsV6gGYcQfkwx9F84zsl7QAUQBWbDstlzFbc0I= + file: dist/*.xar + cleanup: false + on: + tags: true + +before_install: +- docker pull $img +- docker create --name exist-ci -p 8080:8080 $img +install: +- ant +- npm install -g bats +before_script: +- docker cp ./dist/*.xar exist-ci:exist/autodeploy/a1.xar +- docker start exist-ci +- sleep 30 +- docker ps +script: + - curl -s "http://0.0.0.0:8080/exist/rest/db/system/repo/schematron-exist-2.0.0/test/test-suite.xq" -o test/result/test-result.xml + - bats -t test/*.bats + +after_success: +- docker stop exist-ci diff --git a/README.md b/README.md index 777b03c..3702c9d 100644 --- a/README.md +++ b/README.md @@ -1,60 +1,71 @@ # Schematron for eXist +[![Build Status](https://travis-ci.com/duncdrum/schematron-exist.svg?branch=master)](https://travis-ci.com/duncdrum/schematron-exist) -XQuery library module to use ISO Schematron in [eXist](http://exist-db.org/). This module uses the standard Schematron implementation from https://code.google.com/p/schematron/. This module is a port of [schematron-basex](https://github.com/Schematron/schematron-basex) to eXist. +XQuery library module to use ISO Schematron in [eXist](http://exist-db.org/). This module uses the standard Schematron implementation from [https://code.google.com/p/schematron/](https://code.google.com/p/schematron/). This module is a port of [schematron-basex](https://github.com/Schematron/schematron-basex) to eXist. ## Usage - -Install the module in the way described in the eXist documentation. Go to the Dashboard and open the Package Manager. Click the add a package button, and then upload schematron-exist-1.1.xar. +Install the module in the way described in the eXist documentation. Go to the Dashboard and open the Package Manager. Click the add a package button, and then upload `schematron-exist.xar`. After the module is installed, in your XQuery code declare the module import: - +```xquery import module namespace schematron = "http://github.com/Schematron/schematron-exist"; +``` Your Schematron schema file first has to be compiled before it can be used to validate XML. The compiled Schematron can be re-used to validate multiple documents, or possibly stored in a collection for later use. - +```xquery let $sch := schematron:compile(doc('rules.sch')) +``` If your Schematron contains phases you can specify the phase to use by passing the name of the phase in the second argument. - +```xquery let $sch := schematron:compile(doc('rules.sch'), 'phase1') +``` If you need to pass additional parameters to compile the Schematron the second argument can be provided as a parameters element. The phase can be specified by including a parameter named `phase`. - +```xquery let $sch := schematron:compile(doc('rules.sch'), ) +``` Next, validate an XML using the compiled Schematron. - +```xquery let $svrl := schematron:validate(doc('document.xml'), $sch) +``` The validate method returns SVRL XML. This module provides several utility methods for inspecting SVRL. To simply check whether validation has passed or failed use the is-valid method, which returns a boolean value. - +```xquery let $boolean := schematron:is-valid($svrl) +``` Schematron validation may return warnings or informational messages in addition to error messages. The has-messages method returns a boolean value to indicate if any messages are present. - +```xquery let $boolean := schematron:has-messages($svrl) +```` To get all messages that were generated as a sequence: - +```xquery let $messages := schematron:messages($svrl) +``` -The message-level method returns 'error', 'warn' or 'info' (or custom values) based on the `role` attribute on Schematron `` and `` elements. This method normalizes the role attribute value from the Schematron schema: if the role attribute is absent or contains 'error' or 'fatal' this method returns 'error'; if role contains 'warn' or 'warning' this method returns 'warn'; if role contains 'info' or 'information' this method returns 'info'. Any other value of the role attribute is returned unchanged. - +The message-level method returns 'error', 'warn' or 'info' (or custom values) based on the `role` attribute on Schematron `` and `` elements. This method normalizes the role attribute value from the Schematron schema: if the role attribute is absent or contains 'error' or 'fatal' this method returns 'error'; if role contains 'warn' or 'warning' this method returns 'warn'; if role contains 'info' or 'information' this method returns 'info'. Any other value of the role attribute is returned unchanged. +```xquery let $level := schematron:message-level($message) +``` To get the human text description from a message: - +```xquery let $string := schematron:message-description($message) +``` To get the XPath location where a message was generated: - +```xquery let $string := schematron:message-location($message) +``` Putting this all together: -``` +```xquery import module namespace schematron = "http://github.com/Schematron/schematron-exist"; let $sch := schematron:compile(doc('rules.sch')) @@ -80,5 +91,4 @@ This module was developed using eXist 3.0RC1, although it may work with earlier Unit tests are located in the `test` folder. To run the unit tests open `test-suite.xq` in eXide and then click the Eval button. -The included Ant build script build.xml will create a xar file for loading into eXist. - +The included Ant build script build.xml will create a `.xar` file for loading into eXist. diff --git a/build.xml b/build.xml index 70f9cef..3c28f35 100644 --- a/build.xml +++ b/build.xml @@ -1,12 +1,33 @@ - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/content/iso-schematron/iso_abstract_expand.xsl b/content/iso-schematron/iso_abstract_expand.xsl index 0689ab1..5018395 100644 --- a/content/iso-schematron/iso_abstract_expand.xsl +++ b/content/iso-schematron/iso_abstract_expand.xsl @@ -1,4 +1,83 @@ - + + + + + + + - - - - - - - diff --git a/content/iso-schematron/iso_dsdl_include.xsl b/content/iso-schematron/iso_dsdl_include.xsl index f2d8f69..f345b2d 100644 --- a/content/iso-schematron/iso_dsdl_include.xsl +++ b/content/iso-schematron/iso_dsdl_include.xsl @@ -1,4 +1,116 @@ - + + + + + + + - - - - - - diff --git a/content/iso-schematron/iso_schematron_message.xsl b/content/iso-schematron/iso_schematron_message.xsl deleted file mode 100644 index e6f4af2..0000000 --- a/content/iso-schematron/iso_schematron_message.xsl +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - ( - / - ) - - - \ No newline at end of file diff --git a/content/iso-schematron/iso_schematron_message_preamble.txt b/content/iso-schematron/iso_schematron_message_preamble.txt deleted file mode 100644 index 6e4b25d..0000000 --- a/content/iso-schematron/iso_schematron_message_preamble.txt +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - diff --git a/content/iso-schematron/iso_schematron_message_xslt2.xsl b/content/iso-schematron/iso_schematron_message_xslt2.xsl index 9dbc0cb..b3ade50 100644 --- a/content/iso-schematron/iso_schematron_message_xslt2.xsl +++ b/content/iso-schematron/iso_schematron_message_xslt2.xsl @@ -1,4 +1,39 @@ - + + + + + + - - - - - diff --git a/content/iso-schematron/iso_schematron_skeleton_for_saxon.xsl b/content/iso-schematron/iso_schematron_skeleton_for_saxon.xsl index 7230da0..d18f216 100644 --- a/content/iso-schematron/iso_schematron_skeleton_for_saxon.xsl +++ b/content/iso-schematron/iso_schematron_skeleton_for_saxon.xsl @@ -1,4 +1,434 @@ - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - diff --git a/content/iso-schematron/iso_schematron_skeleton_for_xslt1.xsl b/content/iso-schematron/iso_schematron_skeleton_for_xslt1.xsl deleted file mode 100644 index eccf074..0000000 --- a/content/iso-schematron/iso_schematron_skeleton_for_xslt1.xsl +++ /dev/null @@ -1,1457 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - #ALL - - - -false - -true - - - - - true - false - - - - - - - true - false - - - - - - - - - @*| - - * - node() - *|comment()|processing-instruction() - - - - - - - - - -false - - - - - -default - -false - - - -1 - - - - - Schema error: Schematron elements in old and new namespaces found - - - - - - - - - - - - - - - - - Schema error: in the queryBinding attribute, use 'xslt' - - - - - 1.0 - - - - - - - - - This XSLT was automatically generated from a Schematron schema. - - - - - 1.0 - - - - - - - - - - Fail: This implementation of ISO Schematron does not work with - schemas using the "" query language. - - - - - Implementers: please note that overriding process-prolog or process-root is - the preferred method for meta-stylesheets to use where possible. - - - - - - - - - - PHASES - - PROLOG - - KEYS - - DEFAULT RULES - - SCHEMA METADATA - - SCHEMATRON PATTERNS - - - - - - - - - - - - - - - - - - - - - - - Phase Error: no phase with name has been defined. - - - - - - - MODE: SCHEMATRON-SELECT-FULL-PATH - This mode can be used to generate an ugly though full XPath for locators - - - - - - - - - - - - - - - - - - - - - - - - - MODE: SCHEMATRON-FULL-PATH - This mode can be used to generate an ugly though full XPath for locators - - - - - - / - - - - - - [] - - - - *[local-name()=' - ' and namespace-uri()=' - - '] - - - [] - - - - - - - - - - / - - @ - - @*[local-name()=' - - ' and namespace-uri()=' - - '] - - - - - - - - - MODE: SCHEMATRON-FULL-PATH-2 - - This mode can be used to generate prefixed XPath for humans - - - - - - / - - - [ - - ] - - - - - /@ - - - - - MODE: GENERATE-ID-FROM-PATH - - - - - - - - - - - - - - - - - - - - - - . - - - - - - - MODE: SCHEMATRON-FULL-PATH-3 - - - This mode can be used to generate prefixed XPath for humans - (Top-level element has index) - - - - - - / - - - [ - - ] - - - - - /@ - - - - - MODE: GENERATE-ID-2 - - - U - - - U - - - - - U. - - n - - - - - U. - - _ - - _ - - - - - Strip characters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Markup Error: no pattern attribute in <active> - - - - Reference Error: the pattern "" has been activated but is not declared - - - - - - - - Markup Error: no test attribute in <assert - - - ASSERT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Markup Error: no test attribute in <report> - - - - REPORT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Markup Error: no id attribute in <diagnostic> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Markup Error: no rule attribute in <extends> - - - Reference Error: the abstract rule "" has been referenced but is not declared - - - - - - - - - - - - - - Markup Error: no name attribute in <key> - - - Markup Error: no path or use attribute in <key> - - - - - - - - - - - - - - - - Markup Error: no path or use attribute in <key> - - - - - - - - - - - - Schema error: The key element is not in the ISO Schematron namespace. Use the XSLT namespace. - - - - - - - - Schema error: Empty href= attribute for include directive. - - - - - - - - - - - - - - Error: Impossible URL in Schematron include - - - - - - - Schema error: Use include to include fragments, not a whole schema - - - - - - - - - - Schema error: Use include to include fragments, not a whole schema - - - - - - - - - - - - - - - Error: Impossible URL in Schematron include - - - - - - - Schema error: Use include to include fragments, not a whole schema - - - - - - - - - - - Schema error: Use include to include fragments, not a whole schema - - - - - - - - - - Warning: Variables should not be used with the "xpath" query language binding. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Markup Error: no uri attribute in <ns> - - - Markup Error: no prefix attribute in <ns> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //( - - ( - - ) - | - - ) - [not(self::text())] - - - - - - - - - - - - - Schema implementation error: This schema has abstract patterns, yet they are supposed to be preprocessed out already - - - - - - - - - - PATTERN - - - - - - - - - - - - - - - - - - - - Markup Error: no id attribute in <phase> - - - - - - - - Markup Error: no context attribute in <rule> - - - RULE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Markup Error: no id attribute on abstract <rule> - - - Markup Error: (2) context attribute on abstract <rule> - - - - - - Markup Error: context attribute on abstract <rule> - - - - - - - - - - - - - - - - - - - - - - - - - - - Markup Error: no select attribute in <value-of> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Warning: - - must not contain any child elements - - - - - - - - - - - - - - - - - - - - - - - - - Reference error: A diagnostic "" has been referenced but is not declared - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Using the XSLT namespace with a prefix other than "xsl" in - Schematron rules is not supported - in this processor: - - - - - - - - - - - - - - - - - - - - Error: unrecognized element in ISO Schematron namespace: check spelling - and capitalization - - - - - - - - - - - - - Warning: unrecognized element - - - - - - - - - - - - - - - Warning: unrecognized element - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TERMINATING - - - TERMINATING - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TERMINATING - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - title - - - - - - - schema-title - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/content/iso-schematron/iso_schematron_skeleton_for_xslt1_preamble.txt b/content/iso-schematron/iso_schematron_skeleton_for_xslt1_preamble.txt deleted file mode 100644 index b208d16..0000000 --- a/content/iso-schematron/iso_schematron_skeleton_for_xslt1_preamble.txt +++ /dev/null @@ -1,395 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/content/iso-schematron/iso_svrl_for_xslt1.xsl b/content/iso-schematron/iso_svrl_for_xslt1.xsl deleted file mode 100644 index a13faa4..0000000 --- a/content/iso-schematron/iso_svrl_for_xslt1.xsl +++ /dev/null @@ -1,476 +0,0 @@ - - - - - - - - - -true - - - - - - - - - - - #ALL - - -false -true -true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - xslt1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   -   -   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TERMINATING - - - TERMINATING - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TERMINATING - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/content/iso-schematron/iso_svrl_for_xslt1_preamble.txt b/content/iso-schematron/iso_svrl_for_xslt1_preamble.txt deleted file mode 100644 index bb04e8e..0000000 --- a/content/iso-schematron/iso_svrl_for_xslt1_preamble.txt +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - diff --git a/content/iso-schematron/iso_svrl_for_xslt2.xsl b/content/iso-schematron/iso_svrl_for_xslt2.xsl index 7fd4289..373270d 100644 --- a/content/iso-schematron/iso_svrl_for_xslt2.xsl +++ b/content/iso-schematron/iso_svrl_for_xslt2.xsl @@ -1,4 +1,151 @@ + + + + + + + - - - - - - diff --git a/content/iso-schematron/readme.txt b/content/iso-schematron/readme.txt index f3d4d72..685c92e 100644 --- a/content/iso-schematron/readme.txt +++ b/content/iso-schematron/readme.txt @@ -1,101 +1,101 @@ -

ISO SCHEMATRON 2010

- -XSLT implementation by Rick Jelliffe with assistance from members of Schematron-love-in maillist. - -2010-04-21 - -Two distributions are available. One is for XSLT1 engines. -The other is for XSLT2 engines, such as SAXON 9. - - -This version of Schematron splits the process into a pipeline of several different XSLT stages. - -1) First, preprocess your Schematron schema with iso_dsdl_include.xsl. -This is a macro processor to assemble the schema from various parts. -If your schema is not in separate parts, you can skip this stage. -This stage also generates error messages for some common XPath syntax problems. - -2) Second, preprocess the output from stage 1 with iso_abstract_expand.xsl. -This is a macro processor to convert abstract patterns to real patterns. -If your schema does not use abstract patterns, you can skip this -stage. - -3) Third, compile the Schematron schema into an XSLT script. -This will typically use iso_svrl_for_xslt1.xsl or iso_svrl_for_xslt2.xsl -(which in turn invoke iso_schematron_skeleton_for_xslt1.xsl or iso_schematron_skeleton_for_saxon.xsl) -However, other "meta-styleseets" are also in common use; the principle of operation is the same. -If your schema uses Schematron phases, supply these as command line/invocation parameters -to this process. - -4) Fourth, run the script generated by stage 3 against the document being validated. -If you are using the SVRL script, then the output of validation will be an XML document. -If your schema uses Schematron parameters, supply these as command line/invocation parameters -to this process. - - -The XSLT2 distribution also features several next generation features, -such as validating multiple documents. See the source code for details. - -Schematron assertions can be written in any language, of course; the file -sch-messages-en.xhtml contains the diagnostics messages from the XSLT2 skeleton -in English, and this can be used as template to localize the skeleton's -error messages. Note that typically programming errors in Schematron are XPath -errors, which requires localized messages from the XSLT engine. - -ANT ---- -To give an example of how to process a document, here is a sample ANT task. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -EXTRACTION SCHEMATRON FROM XSD OR RELAX NG - -The following files allow extracting of embedded schematron patterns -in XML Schemas or RELAX NG schemas. For details, see the at - article http://www.topologi.com/resources/schtrn_xsd_paper.html - -The following files are provided: - ExtractSchFromRNG.xsl Generate a Schematron schema from patterns - embedded in a RELAX NG schema. The schema uses XSLT1. - ExtractSchFromXSD.xsl Generate a Schematron schema from patterns - embedded in a W3C XML Schemas schema. The schema uses XSLT1. - - ExtractSchFromRNG-2.xsl Generate a Schematron schema from patterns - embedded in a RELAX NG schema. The schema uses XSLT2. - ExtractSchFromXSD-2.xsl Generate a Schematron schema from patterns +

ISO SCHEMATRON 2010

+ +XSLT implementation by Rick Jelliffe with assistance from members of Schematron-love-in maillist. + +2010-04-21 + +Two distributions are available. One is for XSLT1 engines. +The other is for XSLT2 engines, such as SAXON 9. + + +This version of Schematron splits the process into a pipeline of several different XSLT stages. + +1) First, preprocess your Schematron schema with iso_dsdl_include.xsl. +This is a macro processor to assemble the schema from various parts. +If your schema is not in separate parts, you can skip this stage. +This stage also generates error messages for some common XPath syntax problems. + +2) Second, preprocess the output from stage 1 with iso_abstract_expand.xsl. +This is a macro processor to convert abstract patterns to real patterns. +If your schema does not use abstract patterns, you can skip this +stage. + +3) Third, compile the Schematron schema into an XSLT script. +This will typically use iso_svrl_for_xslt1.xsl or iso_svrl_for_xslt2.xsl +(which in turn invoke iso_schematron_skeleton_for_xslt1.xsl or iso_schematron_skeleton_for_saxon.xsl) +However, other "meta-styleseets" are also in common use; the principle of operation is the same. +If your schema uses Schematron phases, supply these as command line/invocation parameters +to this process. + +4) Fourth, run the script generated by stage 3 against the document being validated. +If you are using the SVRL script, then the output of validation will be an XML document. +If your schema uses Schematron parameters, supply these as command line/invocation parameters +to this process. + + +The XSLT2 distribution also features several next generation features, +such as validating multiple documents. See the source code for details. + +Schematron assertions can be written in any language, of course; the file +sch-messages-en.xhtml contains the diagnostics messages from the XSLT2 skeleton +in English, and this can be used as template to localize the skeleton's +error messages. Note that typically programming errors in Schematron are XPath +errors, which requires localized messages from the XSLT engine. + +ANT +--- +To give an example of how to process a document, here is a sample ANT task. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +EXTRACTION SCHEMATRON FROM XSD OR RELAX NG + +The following files allow extracting of embedded schematron patterns +in XML Schemas or RELAX NG schemas. For details, see the at + article http://www.topologi.com/resources/schtrn_xsd_paper.html + +The following files are provided: + ExtractSchFromRNG.xsl Generate a Schematron schema from patterns + embedded in a RELAX NG schema. The schema uses XSLT1. + ExtractSchFromXSD.xsl Generate a Schematron schema from patterns + embedded in a W3C XML Schemas schema. The schema uses XSLT1. + + ExtractSchFromRNG-2.xsl Generate a Schematron schema from patterns + embedded in a RELAX NG schema. The schema uses XSLT2. + ExtractSchFromXSD-2.xsl Generate a Schematron schema from patterns embedded in a W3C XML Schemas schema. The schema uses XSLT2. \ No newline at end of file diff --git a/content/iso-schematron/sch-messages-de.xhtml b/content/iso-schematron/sch-messages-de.xhtml index e1d5445..00e33e6 100644 --- a/content/iso-schematron/sch-messages-de.xhtml +++ b/content/iso-schematron/sch-messages-de.xhtml @@ -1,57 +1,55 @@ - - - - Fehler im Schema: Schematron Elemente sowohl im alten als auch neuen Namensraum gefunden - Fehler im Schema: Nutzen Sie 'xslt' im queryBinding-Attribut - Fehler: Diese Implementierung von ISO Schematron arbeitet nicht mit Schemas zusammen, die die Query Language - nutzen - Phasenfehler: Es gibt keine Phase mit Namen - - Fehler in der Annotation: Kein Attribut pattern in <active> - Referenzierungsfehler: Der Ausdruck " - " wurde aktiviert, ist aber nicht deklariert - Fehler in der Annotation: Kein Attribut test in <assert - Fehler in der Annotation: Kein Attribut test <report> - Fehler in der Annotation: Kein Attribut id in <diagnostic> - Fehler in der Annotation: Kein Attribut rule in <extends> - Referenzierungsfehler: Die abstrakte Regel " - " wurde referenziert, ist aber nicht deklariert - Fehler in der Annotation: Kein Attribut name in <key> - Fehler in der Annotation: Kein Attribut path oder use in <key> - Fehler in der Annotation: Kein Attribut path oder use in <key> - Fehler im Schema: Das Element key ist im ISO Schematron-Namensraum nicht vorhanden. Benutzen Sie den XSLT-Namensraum. - Fehler in der Annotation: Kein Attribut name in <function> - Fehler im Schema: Das Element function ist im ISO Schematron-Namensraum nicht vorhanden. Benutzen Sie den XSLT-Namensraum. - Fehler im Schema: Leeres Attribut href= für include Anweisung. - Fehler: Ungültige URL in Schematron include - Kann die referenzierte Datei nicht öffnen: - - Fehler im Schema: include darf nur zur Einbettung von Schemafragmenten genutzt werden, nicht für ganze Schemata - Fehler im Schema: XSD Schemata dürfen nur importiert werden, wenn das 'xslt2' Query Language Binding genutzt wird - Fehler im Schema: Das Element import-schema ist im ISO Schematron-Namensraum nicht vorhanden. Benutzen Sie den XSLT-Namensraum. - Warnung: Variablen sollten nicht zusammen mit dem "xpath" Query Language Binding genutzt werden. - Warnung: Variablen sollten nicht zusammen mit dem "xpath2" Query Language Binding genutzt werden. - Fehler in der Annotation: Fehlendes Attiribut uri in <ns> - Fehler in der Annotation: Fehlendes Attribut prefix in <ns> - Fehler bei der Schemaimplementierung: Dieses Schema enthält abstrakte Mustervergleiche, die bereits vorverarbeitet sein sollten. - Fehler in der Annotation: Fehlendes Attiribut id in <phase> - Fehler in der Annotation: Fehlendes Attiribut context in <rule> - Fehler in der Annotation: Fehlendes Attiribut id on abstract <rule> - Fehler in der Annotation: (2) context attribute on abstract <rule> - Fehler in der Annotation: Attribut context bei abstrakter <rule> - Fehler in der Annotation: Fehlendes Attiribut select in <value-of> - Warnung: - darf keine Kindelemente beinhalten - Referenzierungsfehler: Ein diagnostic-Element " - " wurde referenziert, ist aber nicht deklariert - Der Gebrauch des XSLT-Namensraums mit einem anderen Präfix als "xsl" in Schematron-Regeln wird von diesem Prozessor nicht unterstützt: - - Fehler: Unbekanntes Element im ISO Schematron-Namensraum: Überprüfen Sie die Schreibweise (inkl. Groß- und Kleinschreibung) - - Warnung: Unbekanntes Element - - + + + Fehler im Schema: Schematron Elemente sowohl im alten als auch neuen Namensraum gefunden + Fehler im Schema: Nutzen Sie 'xslt' als Wert für das 'queryBinding'-Attribut + Fehler: Diese Implementierung von ISO Schematron unterstützt keine Schemas, welche die Query Language + nutzen + Phasenfehler: Es gibt keine Phase mit Namen + + Fehler in der Annotation: Kein Attribut 'pattern' in <active> + Referenzierungsfehler: Der Ausdruck " + " wurde aktiviert, ist aber nicht deklariert + Fehler in der Annotation: Kein Attribut 'test' in <assert + Fehler in der Annotation: Kein Attribut 'test' in <report> + Fehler in der Annotation: Kein Attribut 'id' in <diagnostic> + Fehler in der Annotation: Kein Attribut 'rule' in <extends> + Referenzierungsfehler: Die abstrakte Regel " + " wurde referenziert, ist aber nicht deklariert + Fehler in der Annotation: Kein Attribut 'name' in <key> + Fehler in der Annotation: Kein Attribut 'path' oder 'use' in <key> + Fehler in der Annotation: Kein Attribut 'path' oder 'use' in <key> + Fehler im Schema: Das Element <key> ist im ISO Schematron-Namensraum nicht vorhanden. Benutzen Sie den XSLT-Namensraum. + Fehler in der Annotation: Kein Attribut 'name' in <function> + Fehler im Schema: Das Element <function> ist im ISO Schematron-Namensraum nicht vorhanden. Benutzen Sie den XSLT-Namensraum. + Fehler im Schema: Leeres Attribut 'href' für <include> Anweisung. + Fehler: Ungültige URL in <include> + Kann die referenzierte Datei nicht öffnen: + + Fehler im Schema: <include> darf nur zur Einbettung von Schemafragmenten genutzt werden, nicht für ganze Schemata + Fehler im Schema: XSD Schemata dürfen nur importiert werden, wenn das 'xslt2' Query Language Binding genutzt wird + Fehler im Schema: Das Element <import-schema> ist im ISO Schematron-Namensraum nicht vorhanden. Benutzen Sie den XSLT-Namensraum. + Warnung: Variablen sollten nicht zusammen mit dem 'xpath' Query Language Binding genutzt werden. + Warnung: Variablen sollten nicht zusammen mit dem 'xpath2' Query Language Binding genutzt werden. + Fehler in der Annotation: Fehlendes Attribut 'uri' in <ns> + Fehler in der Annotation: Fehlendes Attribut 'prefix' in <ns> + Fehler bei der Schemaimplementierung: Dieses Schema enthält abstrakte Mustervergleiche, die bereits vorverarbeitet sein sollten. + Fehler in der Annotation: Fehlendes Attribut 'id' in <phase> + Fehler in der Annotation: Fehlendes Attribut 'context' in <rule> + Fehler in der Annotation: Fehlendes Attribut 'id' an abstrakter <rule> + Fehler in der Annotation: (2) Kontext-Attribut an abstrakter <rule> + Fehler in der Annotation: Attribut 'context' an abstrakter <rule> + Fehler in der Annotation: Fehlendes Attribut 'select' in <value-of> + Warnung: + darf keine Kindelemente beinhalten + Referenzierungsfehler: Ein <diagnostic>-Element " + " wurde referenziert, ist aber nicht deklariert + Der Gebrauch des XSLT-Namensraums mit einem anderen Präfix als 'xsl' in Schematron-Regeln wird von diesem Prozessor nicht unterstützt: + + Fehler: Unbekanntes Element im ISO Schematron-Namensraum: Überprüfen Sie die Schreibweise (inkl. Groß- und Kleinschreibung) + + Warnung: Unbekanntes Element + + diff --git a/content/iso-schematron/sch-messages-en.xhtml b/content/iso-schematron/sch-messages-en.xhtml index 5e266eb..6f777ed 100644 --- a/content/iso-schematron/sch-messages-en.xhtml +++ b/content/iso-schematron/sch-messages-en.xhtml @@ -1,57 +1,57 @@ - - - - Schema error: Schematron elements in old and new namespaces found - Schema error: in the queryBinding attribute, use 'xslt' - Fail: This implementation of ISO Schematron does not work with schemas using the query language - - Phase Error: no phase has been defined with name - - Markup Error: no pattern attribute in <active> - Reference Error: the pattern " - " has been activated but is not declared - Markup Error: no test attribute in <assert> - Markup Error: no test attribute in <report> - Markup Error: no id attribute in <diagnostic> - Markup Error: no rule attribute in <extends> - Reference Error: the abstract rule " - " has been referenced but is not declared - Markup Error: no name attribute in <key> - Markup Error: no path or use attribute in <key> - Markup Error: no path or use attribute in <key> - Schema error: The <key> element is not in the ISO Schematron namespace. Use the XSLT namespace. - Markup Error: no name attribute in <function> - Schema error: The <function> element is not in the ISO Schematron namespace. Use the XSLT namespace. - Schema error: Empty href attribute for <include> directive. - Error: Impossible URL in Schematron <include> - Error: Unable to open referenced included file: - - Schema error: Use <include> to include fragments, not a whole schema - Schema error: XSD schemas may only be imported if you are using the 'xslt2' query language binding - Schema error: The <import-schema> element is not available in the ISO Schematron namespace. Use the XSLT namespace. - Warning: Variables should not be used with the "xpath" query language binding. - Warning: Variables should not be used with the "xpath2" query language binding. - Markup Error: no uri attribute in <ns> - Markup Error: no prefix attribute in <ns> - Schema implementation error: This schema has abstract patterns, yet they are supposed to be preprocessed out already - Markup Error: no id attribute in <phase> - Markup Error: no context attribute in <rule> - Markup Error: no id attribute on abstract <rule> - Markup Error: (2) context attribute on abstract <rule> - Markup Error: context attribute on abstract <rule> - Markup Error: no select attribute in <value-of> - Warning: - must not contain any child elements - Reference error: A diagnostic " - " has been referenced but is not declared - Warning: Using the XSLT namespace with a prefix other than "xsl" in Schematron rules is not supported in this processor: - - Error: unrecognized element in ISO Schematron namespace: check spelling and capitalization - - Warning: unrecognized element - + + + + Schema error: Schematron elements in old and new namespaces found + Schema error: in the queryBinding attribute, use 'xslt' + Fail: This implementation of ISO Schematron does not work with schemas using the query language + + Phase Error: no phase has been defined with name + + Markup Error: no pattern attribute in <active> + Reference Error: the pattern " + " has been activated but is not declared + Markup Error: no test attribute in <assert> + Markup Error: no test attribute in <report> + Markup Error: no id attribute in <diagnostic> + Markup Error: no rule attribute in <extends> + Reference Error: the abstract rule " + " has been referenced but is not declared + Markup Error: no name attribute in <key> + Markup Error: no path or use attribute in <key> + Markup Error: no path or use attribute in <key> + Schema error: The <key> element is not in the ISO Schematron namespace. Use the XSLT namespace. + Markup Error: no name attribute in <function> + Schema error: The <function> element is not in the ISO Schematron namespace. Use the XSLT namespace. + Schema error: Empty href attribute for <include> directive. + Error: Impossible URL in Schematron <include> + Error: Unable to open referenced included file: + + Schema error: Use <include> to include fragments, not a whole schema + Schema error: XSD schemas may only be imported if you are using the 'xslt2' query language binding + Schema error: The <import-schema> element is not available in the ISO Schematron namespace. Use the XSLT namespace. + Warning: Variables should not be used with the "xpath" query language binding. + Warning: Variables should not be used with the "xpath2" query language binding. + Markup Error: no uri attribute in <ns> + Markup Error: no prefix attribute in <ns> + Schema implementation error: This schema has abstract patterns, yet they are supposed to be preprocessed out already + Markup Error: no id attribute in <phase> + Markup Error: no context attribute in <rule> + Markup Error: no id attribute on abstract <rule> + Markup Error: (2) context attribute on abstract <rule> + Markup Error: context attribute on abstract <rule> + Markup Error: no select attribute in <value-of> + Warning: + must not contain any child elements + Reference error: A diagnostic " + " has been referenced but is not declared + Warning: Using the XSLT namespace with a prefix other than "xsl" in Schematron rules is not supported in this processor: + + Error: unrecognized element in ISO Schematron namespace: check spelling and capitalization + + Warning: unrecognized element + \ No newline at end of file diff --git a/content/iso-schematron/sch-messages-fr.xhtml b/content/iso-schematron/sch-messages-fr.xhtml index 574b5cb..a797db7 100644 --- a/content/iso-schematron/sch-messages-fr.xhtml +++ b/content/iso-schematron/sch-messages-fr.xhtml @@ -1,54 +1,54 @@ - - - Erreur de schema: éléments Schematron à la fois dans l'ancien et le nouveau namespace - Erreur de schema: utilisez 'xslt' dans l'attribut queryBinding - Échec: Cette implémentation de Schematron ISO ne fonctionne pas avec des schemas utilisant le langage de query - - Erreur de phase: aucune phase n'a été définie avec le nom - - Erreur de balisage: pas d'attribut pattern dans <active> - Erreur de référence: le pattern " - " a été activé mais n'a pas été décalaré - Erreur de balisage: pas d'attribut test dans <assert> - Erreur de balisage: pas d'attribut test dans <report> - Erreur de balisage: pas d'attribut id dans <diagnostic> - Erreur de balisage: pas d'attribut rule dans <extends> - Erreur de référence: la règle abstraite " - " a été référencée mais pas déclarée - Erreur de balisage: pas d'attribut name dans <key> - Erreur de balisage: pas d'attribut path ou use dans <key> - Erreur de schema: L'élément key n'est pas dans le namespace Schematron ISO. Utilisez le namespace XSLT. - Erreur de balisage: pas d'attribut name dans <function> - Erreur de schema: L'élément function n'est pas dans le namespace Schematron ISO. Utilisez le namespace XSLT. - Erreur de schema: Attribut href vide sur a directive include. - Erreur: URL impossible dans la directive include de Schematron - Impossible d'ouvrir le fichier référencé pour l'inclusion: - - Erreur de schema: Utilisez include pour inclure des fragments et non un schema entier - Erreur de schema: Les schema XSD peuvent être importés seulement si vous utilisez the langage de query 'xslt2' - Erreur de schema: L'élément import-schema n'est pas disponible dans le namespace Schematron ISO. Utilisez le namespace XSLT. - Avertissement: Des variables ne devraient pas être utiliées avec le langage de query "xpath". - Avertissement: Des variables ne devraient pas être utiliées avec le langage de query "xpath2". - Erreur de balisage: pas d'attribut uri dans <ns> - Erreur de balisage: pas d'attribut prefix dans <ns> - Erreur d'implémentation de schema: Ce schema des patterns abstraits, bien qu'ils sont supposés avoir été préprocessés précédemment - Erreur de balisage: pas d'attribut id dans <phase> - Erreur de balisage: pas d'attribut context dans <rule> - Erreur de balisage: pas d'attribut id dans <rule> - Erreur de balisage: (2) attribut context dans une <rule> abstraite - Erreur de balisage: attribut context dans une <rule> abstraite - Erreur de balisage: pas d'attribut select dans <value-of> - Avertissement: - ne peut contenir aucun élément enfant - Erreur de référence: Un diagnostique " - " a été référencé mais n'est pas déclaré - Utiliser the namespace XSLT avec un autre préfixe que "xsl" dans les rules Schematron n'est pas supporté par ce processor: - - Erreur: élément inconnu dans le namespace Schematron ISO: vérifiez l'orthographe et la casse - - Avertissement: élément inconnu - - + + + Erreur de schema: éléments Schematron à la fois dans l'ancien et le nouveau namespace + Erreur de schema: utilisez 'xslt' dans l'attribut queryBinding + Échec: Cette implémentation de Schematron ISO ne fonctionne pas avec des schemas utilisant le langage de query + + Erreur de phase: aucune phase n'a été définie avec le nom + + Erreur de balisage: pas d'attribut pattern dans <active> + Erreur de référence: le pattern " + " a été activé mais n'a pas été décalaré + Erreur de balisage: pas d'attribut test dans <assert> + Erreur de balisage: pas d'attribut test dans <report> + Erreur de balisage: pas d'attribut id dans <diagnostic> + Erreur de balisage: pas d'attribut rule dans <extends> + Erreur de référence: la règle abstraite " + " a été référencée mais pas déclarée + Erreur de balisage: pas d'attribut name dans <key> + Erreur de balisage: pas d'attribut path ou use dans <key> + Erreur de schema: L'élément key n'est pas dans le namespace Schematron ISO. Utilisez le namespace XSLT. + Erreur de balisage: pas d'attribut name dans <function> + Erreur de schema: L'élément function n'est pas dans le namespace Schematron ISO. Utilisez le namespace XSLT. + Erreur de schema: Attribut href vide sur a directive include. + Erreur: URL impossible dans la directive include de Schematron + Impossible d'ouvrir le fichier référencé pour l'inclusion: + + Erreur de schema: Utilisez include pour inclure des fragments et non un schema entier + Erreur de schema: Les schema XSD peuvent être importés seulement si vous utilisez the langage de query 'xslt2' + Erreur de schema: L'élément import-schema n'est pas disponible dans le namespace Schematron ISO. Utilisez le namespace XSLT. + Avertissement: Des variables ne devraient pas être utiliées avec le langage de query "xpath". + Avertissement: Des variables ne devraient pas être utiliées avec le langage de query "xpath2". + Erreur de balisage: pas d'attribut uri dans <ns> + Erreur de balisage: pas d'attribut prefix dans <ns> + Erreur d'implémentation de schema: Ce schema des patterns abstraits, bien qu'ils sont supposés avoir été préprocessés précédemment + Erreur de balisage: pas d'attribut id dans <phase> + Erreur de balisage: pas d'attribut context dans <rule> + Erreur de balisage: pas d'attribut id dans <rule> + Erreur de balisage: (2) attribut context dans une <rule> abstraite + Erreur de balisage: attribut context dans une <rule> abstraite + Erreur de balisage: pas d'attribut select dans <value-of> + Avertissement: + ne peut contenir aucun élément enfant + Erreur de référence: Un diagnostique " + " a été référencé mais n'est pas déclaré + Utiliser the namespace XSLT avec un autre préfixe que "xsl" dans les rules Schematron n'est pas supporté par ce processor: + + Erreur: élément inconnu dans le namespace Schematron ISO: vérifiez l'orthographe et la casse + + Avertissement: élément inconnu + + diff --git a/content/iso-schematron/sch-messages-ja.xhtml b/content/iso-schematron/sch-messages-ja.xhtml new file mode 100644 index 0000000..bedf32b --- /dev/null +++ b/content/iso-schematron/sch-messages-ja.xhtml @@ -0,0 +1,53 @@ + + + スキーマエラー:古い名前空間と新しい名前空間にはSchematron 要素が見つかりました。 + スキーマエラー:検索結合属性では、 'xslt'を使用する。 + 失敗: ISO Schematron の 実行 は、スキーマが検索言語を使用してできない。 + + フェーズ エラー: フェーズは名前で定義されていない。 + + マークアップエラー: <active>にはパターンの属性がない + 参照エラー: パターン が " + " 活性化されているが宣言されていない。 + マークアップエラー: <assert> にはtestの属性がない + マークアップエラー: <report> にはtestの属性がない + マークアップエラー: <diagnostic> にはidの属性がない   + マークアップエラー:  <extends> にはruleの属性がない + 参照エラー: 抽象的な規則が " + " 参照されているが宣言されていない。 + マークアップエラー: <key>にはnameの属性がない + マークアップエラー: <key>にはpath か 又は useの 属性がない + マークアップエラー:  <key>には path か 又は useの 属性がない + スキーマエラー: <key> の要素はISO Schematronの 名前空間にはない. XSLTの名前空間を使用する。 + マークアップエラー: <function>にはnameの属性がない + スキーマエラー: <function> の要素はISO Schematronの 名前空間にはない. XSLTの名前空間を使用する。 + スキーマエラー: <include>のために空hrefの属性がある。 + エラー: Schematron <include>には不可能なURL がある + エラー: 参照したファイルが含まれて、開けない : + + スキーマエラー:全体のスキーマではなく、フラグメントを含む <include> を使用する。 + スキーマエラー: 'xslt2'の検索言語結合を使用している場合はXSDスキーマのみ読み込みできる。 + スキーマエラー:ISO Schematron の名前空間には <import-schema>の要素は無効です。 XSLTの 名前空間を使用する。 + 注意: 変数は、"xpath" 検索言語結合を使用すべきではない。 + 注意: 変数は、"xpath" 検索言語結合を使用すべきではない。 + マークアップエラー: <ns>にはuriの属性がない + マークアップエラー: <ns>にはprefixの属性がない + スキーマ実行 エラー: このスキーマは抽象的なパターンを持って、まだすでに前加工されることになっている。 + マークアップエラー: <phase>にはidの属性がない + マークアップエラー: <rule>にはcontextの要素がない + マークアップエラー: 抽象的な <rule>にはid属性がない。 + マークアップエラー: (2) 抽象的な <rule>にはcontext属性がない。 + マークアップエラー: 抽象的な <rule>にはcontext属性がない。 + マークアップエラー: <value-of>には selectの属性がない + 注意: + 子要素が含まれなくてはならない + 参照エラー: 診断は " + " 参照されているが宣言されていない。 + 注意: Schematron規則で"xsl"以外の接頭辞 XSLT 名前空間を使用することは、このプロセサーで サーポトしていない。 + + エラー: ISO Schematron 名前空間に不明な要素がある: 綴り字と大文字使用を確認する + + 注意: 不明な要素 + + diff --git a/content/iso-schematron/sch-messages-nl.xhtml b/content/iso-schematron/sch-messages-nl.xhtml index 8258377..5f05577 100644 --- a/content/iso-schematron/sch-messages-nl.xhtml +++ b/content/iso-schematron/sch-messages-nl.xhtml @@ -1,58 +1,58 @@ - - - Schema fout: er werden Schematron elementen uit de oude en nieuwe - namespace gevonden - Schema fout: gebruik 'xslt' in het queryBinding attribute - Faling: Deze implementatie van ISO Schematron werkt niet met - schemas die gebruik maken van de query language - - Fase fout: er is geen 'phase' gedefinieerd met naam - - Markup fout: er is geen 'pattern' attribuut in <active> - Referentie fout: het 'pattern' " - " is geactiveerd maar niet gedeclareerd - Markup fout: er is geen 'test' attribuut in <assert - Markup fout: er is geen 'test' attribuut in <report> - Markup fout: er is geen 'id' attribuut in <diagnostic> - Markup fout: er is geen 'rule' attribuut in <extends> - Referentie fout: de abstracte regel " - " werd gerefereerd maar niet gedeclareerd - Markup fout: er is geen 'name' attribuut in <key> - Markup fout: er is geen 'path' of 'use' attribuut in <key> - Markup fout: er is geen 'path' of 'use' attribuut in <key> - Schema fout: Het 'key' element zit niet in de ISO Schematron namespace. Gebruik de XSLT namespace. - Markup fout: er is geen 'name' attribuut in <function> - Schema fout: Het 'function' element zit niet in de ISO Schematron namespace. Gebruik de XSLT namespace. - Schema fout: Leeg 'href=' attribuut bij de include opdracht. - Fout: Onmogelijke URL gebruikt bij de Schematron include - Kan de gerefereerde 'include' file niet openen: - - Schema fout: Gebruik include om fragmenten op te nemen, niet een volledig schema - Schema fout: XSD schemas kunnen enkel geïmporteerd worden indien de 'xslt2' query language binding gebruikt is - Schema fout: Het 'import-schema' element is niet beschikbaar in the ISO Schematron namespace. Gebruik de XSLT namespace. - Waarschuwing: Variabelen niet gebruiken met de "xpath" query language binding. - Waarschuwing: Variabelen niet gebruiken met de "xpath2" query language binding. - Markup fout: er is geen 'uri' attribute in <ns> - Markup fout: er is geen 'prefix' attribute in <ns> - Schema implementatie fout: Dit schema heeft abstracte patronen, die al gepreprocessed zouden moeten zijn - Markup fout: er is geen 'id' attribuut in <phase> - Markup fout: er is geen 'context' attribuut in <rule> - Markup fout: er is geen 'id' attribuut op abstracte <rule> - Markup fout: (2) context attributen op abstracte <rule> - Markup fout: context attribuut op abstracte <rule> - Markup fout: er is geen 'select' attribute in <value-of> - Waarschuwing: - mag geen kind elementen bevatten - Referentie fout: Een diagnostic " - " werd gerefereerd maar is niet gedeclareerd. - Het gebruik van de XSLT namespace met een prefix verschillend - van "xsl" in Schematron regels wordt niet ondersteund in deze processor: - - Fout: een niet herkend element in de ISO Schematron namespace: check spelling en hoofdlettergebruik - - Waarschuwing: een niet herkend element - - + + + Schema fout: er werden Schematron elementen uit de oude en nieuwe + namespace gevonden + Schema fout: gebruik 'xslt' in het queryBinding attribute + Faling: Deze implementatie van ISO Schematron werkt niet met + schemas die gebruik maken van de query language + + Fase fout: er is geen 'phase' gedefinieerd met naam + + Markup fout: er is geen 'pattern' attribuut in <active> + Referentie fout: het 'pattern' " + " is geactiveerd maar niet gedeclareerd + Markup fout: er is geen 'test' attribuut in <assert + Markup fout: er is geen 'test' attribuut in <report> + Markup fout: er is geen 'id' attribuut in <diagnostic> + Markup fout: er is geen 'rule' attribuut in <extends> + Referentie fout: de abstracte regel " + " werd gerefereerd maar niet gedeclareerd + Markup fout: er is geen 'name' attribuut in <key> + Markup fout: er is geen 'path' of 'use' attribuut in <key> + Markup fout: er is geen 'path' of 'use' attribuut in <key> + Schema fout: Het 'key' element zit niet in de ISO Schematron namespace. Gebruik de XSLT namespace. + Markup fout: er is geen 'name' attribuut in <function> + Schema fout: Het 'function' element zit niet in de ISO Schematron namespace. Gebruik de XSLT namespace. + Schema fout: Leeg 'href=' attribuut bij de include opdracht. + Fout: Onmogelijke URL gebruikt bij de Schematron include + Kan de gerefereerde 'include' file niet openen: + + Schema fout: Gebruik include om fragmenten op te nemen, niet een volledig schema + Schema fout: XSD schemas kunnen enkel geïmporteerd worden indien de 'xslt2' query language binding gebruikt is + Schema fout: Het 'import-schema' element is niet beschikbaar in the ISO Schematron namespace. Gebruik de XSLT namespace. + Waarschuwing: Variabelen niet gebruiken met de "xpath" query language binding. + Waarschuwing: Variabelen niet gebruiken met de "xpath2" query language binding. + Markup fout: er is geen 'uri' attribute in <ns> + Markup fout: er is geen 'prefix' attribute in <ns> + Schema implementatie fout: Dit schema heeft abstracte patronen, die al gepreprocessed zouden moeten zijn + Markup fout: er is geen 'id' attribuut in <phase> + Markup fout: er is geen 'context' attribuut in <rule> + Markup fout: er is geen 'id' attribuut op abstracte <rule> + Markup fout: (2) context attributen op abstracte <rule> + Markup fout: context attribuut op abstracte <rule> + Markup fout: er is geen 'select' attribute in <value-of> + Waarschuwing: + mag geen kind elementen bevatten + Referentie fout: Een diagnostic " + " werd gerefereerd maar is niet gedeclareerd. + Het gebruik van de XSLT namespace met een prefix verschillend + van "xsl" in Schematron regels wordt niet ondersteund in deze processor: + + Fout: een niet herkend element in de ISO Schematron namespace: check spelling en hoofdlettergebruik + + Waarschuwing: een niet herkend element + + diff --git a/content/iso-schematron/schematron-skeleton-api.htm b/content/iso-schematron/schematron-skeleton-api.htm index 165899c..af81377 100644 --- a/content/iso-schematron/schematron-skeleton-api.htm +++ b/content/iso-schematron/schematron-skeleton-api.htm @@ -1,723 +1,723 @@ - - - - - The ISO Schematron Skeleton API - - - - - -

API for ISO Schematron Skeleton

-



-

-

Rick Jelliffe, 2010/04/14

-

This document provides documentation on the XSLT API available in -the implementation of Schematron called iso_schematron_skeleton.xsl. -(available in an XSLT1 and XSLT2 version). The API makes available as -much information from the schema, however there may be some edge -cases where it is not exhaustive. -

-

The skeleton is an XSLT script which provides all the basic -parsing and validating routines for compiling a Schematron schema -into XSLT. Schematron was designed to allow many different uses, and -the skeleton gives you a headstart in creating a customized -implementation. You just need to write XSLT templates to override the -default ones. (The program you write is sometimes called a -meta-stylesheet.) It is the meta-stylesheet that is called -as the XSLT script, not the skeleton. There are several -pre-processing stages which the Schematron schema should be processed -through first, to handle such things as include statements and -abstract patterns. -

-

Phases and error reporting for problems in the schema itself are -handled by the skeleton with no interaction with a “meta-stylesheet”. -Note that there is no guarantee that the context node is always the -element being handled: in most cases the only information available -is the information in the parameters. -

-

For an introductory tutorial on using this API, see Bob DuCharme's -Schematron 1.5: -Looking Under the Hood -

-

Superset of API for Schematron 1.5 and 1.6

-

(This is an updated version of the API for the Schematron 1.5 -implementation called skeleton1-5.xsl, which in turn comes -from the new architecture contributed by Oliver Becker for -Schematron 1.3.)

-

The current API contains only additions. Well-written -meta-stylesheets that use the new API will be be able to run on the -existing 1.5 and 1.6 skeletons. Similarly, it should be possible to -upgrade the skeleton from 1.5 or 1.6 to the iso-schematron-skeleton -only by correcting the import statement at the beginning of the -meta-stylsheet. Additions or re-groupings from the 1.5 schema are -shown in red. Deletions have overstrike.

-

Mooted addition: a parameter @action which for specifying -processing instructions on assertions and reports.

-
-

process-prolog

-

The process-prolog template gets called at the start of -the validation session. It has no parameters. The default -implementation is no action.

-
-

process-root

-

The process-root template processes the root element of -the schema (which is not the same thing as the root of the document / -and need not be the document element /*) .

-
-
node-list $contents -
- string $schemaVersion -
- The version of the schema, perhaps a datestamp. -
- "xslt" | "xpath" | - "xslt2" | ... - $queryBinding -
- The query language binding. -
- string $title -
- The title of this schema -
- "iso" | "1.5" | - "1.6" | ... - $version -
- The version of Schematron being used. -
-

-Rich properties:

-
-
XML SystemId - $icon -
- The URI of an icon -
- XML ID - $id -
- The unique identifier with the schema for the - schema - element. -
- SGML FPI - $fpi -
- The Formal Public Identifier for this schema. -
- IETF language - $lang -
- The human language used in this schema, from - xml:lang -
- URL - $see -
- Link to documentation on WWW or file -
- "preserve" | "default" - $space -
- The value for xml:space -
-

-To print the documentation paragraphs, use <xsl:apply-templates -mode="do-schema-p" />

-

To output the results, use <xsl:copy-of select="$contents" -/>

-
-

process-assert

-

The process-assert template handles asserts whose test -has failed. -

-
-
XPath $test -
- The test -
- XML IDREFS $diagnostics -
- A list of the idrefs diagnostic elements related to the current - assertion -
- XML NMTOKEN - $flag -
- The name of a flag that becomes true because - this assertion fails. The flag is true for the document if it is - flagged true on any assertion. For compatability, this parameter - should not be used with Schematron 1.5. -
-

-Rich properties:

-
-
XML SystemId - $icon -
- The URI of an icon -
- XML ID - $id -
- The unique identifier with the schema for the - assert - element. -
- SGML FPI - $fpi -
- The Formal Public Identifier for this - assertion. -
- IETF language - $lang -
- The human language used in this assertion, - from xml:lang -
- URL - $see -
- Link to documentation on WWW or file -
- "preserve" | "default" - $space -
- The value for xml:space -
-

-Linking properties:

-
-
XML NMTOKEN - $role -
- A name for the generic role of this assertion. - The schema creator would have their own vocabulary. -
- XPath - $subject -
- A path relative to the current context to some - interesting node considered the subject. -
-

-To print the text contents, use <xsl:apply-templates -mode="text" />

-
-

process-diagnostic

-

The process-diagnostic template handles diagnostic -messages for assert statements that have failed and report -statements that have succeeded. The diagnostics are evaluated in the -context of the rule.

-

Rich properties:

-
-
XML SystemId - $icon -
- The URI of an icon -
- XML ID - $id -
- The unique identifier with the schema for the - assert - element. -
- SGML FPI - $fpi -
- The Formal Public Identifier for this - assertion. -
- IETF language - $lang -
- The human language used in this assertion, - from xml:lang -
- URL - $see -
- Link to documentation on WWW or file -
- "preserve" | "default" - $space -
- The value for xml:space -

-
-

process-dir

-

The process-dir template handles bi-directionality -markup, which is only needed by certain human scripts such as Arabic.

-
-
"ltr" or "rtl" or "" - $value -
- Left-to-right or right-to-left or unspecified -

-
-

process-emph

-

The process-emph template handles the markup of -emphasized text in paragraphs, assertions and diagnostics. It has no -parameters.

-
-

process-message

-

The process-message handles default outputing of text.

-
-
string $pattern -
- Some text that may be some kind of pattern -
- string $role -
- Some text that may be some kind of role -

-
-

process-name

-

The process-name templates handle name strings that can -be used in assertions. asssert and report only -provide name subelements rather than the more general -value-of elements to encourage plain language and generic -descriptions rather than specific diagnostics, for which purpose the -diagnostics elements are used.

-
-
string $name -
- The name of the current element, or of the node specified by a name - element -

-
-

process-ns

-

The process-ns template reports on ns -declarations, which are used to transmit on namespace information by -the skeleton.

-
-
Namespace NCName $prefix -
- The prefix of a namespace -
- XML SystemId $uri -
- The (internationalized) URI Reference of a namespace -

-
-

process-p

-

The process-p template handles paragraphs.

-
-
XML NMTOKEN $class -
- An attribute that can be used for stylesheet style -
- XML ID $id -
- The unique identifier with the schema for the p element. -
- XML SystemId $icon -
- The URI of an icon -
- IETF Language $lang -
- The human language used in this paragraph -
-

-To print the text contents, use <xsl:apply-templates -mode="text" /> -

-
-

process-pattern

-

The process-pattern reports on the start of evaluation of -a pattern element.

-
-
string $name -
- The title of the current pattern -
- XML NCNAMES $is-a -
- Empty or not provided if the pattern is not derived from an abstract - pattern. Otherwise the name of the abstract pattern. A list may be - used if there was a sequence of abstract patterns. -
-

-Rich properties:

-
-
XML SystemId - $icon -
- The URI of an icon -
- XML ID - $id -
- The unique identifier with the schema for the - pattern - element. -
- SGML FPI - $fpi -
- The Formal Public Identifier for this pattern. - -
- IETF language - $lang -
- The human language used in this pattern, from - xml:lang -
- URL - $see -
- A (internationalized) URI reference to some - supporting or defining documentation -
- "preserve" | "default" - $space -
- The value for xml:space -
-

-To print the documentation contents, use <xsl:apply-templates -mode="do-pattern-p"/>

-
-

process-report

-

The process-report template handles report whose -test has succeeded. -

-
-
XPath $test -
- The test -
- XML IDREFS $diagnostics -
- A list of the diagnostic elements related to the current assertion -
- XML NMTOKEN - $flag -
- The name of a flag that becomes true because - this assertion fails. The flag is true for the document if it is - flagged true on any assertion. For compatability, this parameter - should not be used with Schematron 1.5. -
-

-Rich properties:

-
-
XML SystemId - $icon -
- The URI of an icon -
- XML ID - $id -
- The unique identifier with the schema for the - report - element. -
- SGML FPI - $fpi -
- The Formal Public Identifier for this report. -
- IETF language - $lang -
- The human language used in this report, from - xml:lang -
- URL - $see -
- Link to documentation on WWW or file -
- "preserve" | "default" - $space -
- The value for xml:space -
-

-Linking properties:

-
-
XML NMTOKEN - $role -
- A name for the generic role of this assertion. - The schema creator would have their own vocabulary. -
- XPath - $subject -
- A path relative to the current context to some - interesting node considered the subject. -
-

-To print the text contents, use <xsl:apply-templates -mode="text" />

-
-

process-rule

-

The process-rule reports that a rule element has -fired: its context attribute matched some nodes. .

-
-
XSLT expression $context -
- The expression that gives the context of the current -
-

-Rich properties:

-
-
XML SystemId - $icon -
- The URI of an icon -
- XML ID - $id -
- The unique identifier with the schema for this - rule - element. -
- SGML FPI - $fpi -
- The Formal Public Identifier for this rule. -
- IETF language - $lang -
- The human language used in this rule, from - xml:lang -
- URL - $see -
- Link to documentation on WWW or file -
- "preserve" | "default" - $space -
- The value for xml:space -
-

-Linking properties:

-
-
XML NMTOKEN - $role -
- A name for the generic role of this assertion. - The schema creator would have their own vocabulary. -
- XPath - $subject -
- A path relative to the current context to some - interesting node considered the subject. -

-
-

process-span

-

The process-span handles span elements, which are generic -elements for styling, like HTML's .

-
-
XML NMTOKEN $class -
- An attribute that can be used for stylesheet style -

-
-

process-title

-

The process-title handles title elements, which are -generic elements for styling, like HTML's .

-
-
XML NMTOKEN $class -
- An attribute that can be used for stylesheet style -
-

-By default, titles are handled by invocing process-p with -the parameter class with a value "title".

-
-

process-value-of

-

The process-value-of template handles value-of -elements, which are used in diagnostic messages to allow very -specific hinting .

-
-
XPath $select -
- The path of some node that will be evaluated and printed.

-
-

Global Parameters

-

There are several global parameters that may be available for use. -However, it is not a requirement to follow these, and implementations -may not supply them with any value. So a test of -string-length(variable) < -0 is appropriate in each case.

-



-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Parameter

-
-

Value

-
-

Description

-
-

allow-foreign

-
-

"true" | "false" (default) -

-
-

Pass non-Schematron elements to the generated - stylesheet. Pass the Schematron elements span, emph and dir: to - the output SVRL. -

-
-

fileNameParameter

-
-

string

-
-

A parameter passed to the Validator and - potentially available as a variable in Schematron schemas as - $fileNameParameter

-
-

fileDirParameter

-
-

string

-
-

A parameter passed to the Validator and - potentially available as a variable in Schematron schemas as - $fileDirParameter

-
-

archiveNamePaameter

-
-

string

-
-

A parameter passed to the Validator and - potentially available as a variable in Schematron schemas as - $archiveNameParameter

-
-

archiveDirParameter

-
-

string

-
-

A parameter passed to the Validator and - potentially available as a variable in Schematron schemas as - $archivePathParameter

-
-

debug -

-
-

true” | “false” (default)

-
-

Verbose error messages (Note this may be - superceded by “verbose” at some stage in the future.)

-
-

generate-paths

-
-

true|false -

-
-

generate the SVRL @location attribute with XPaths

-
-

diagnose

-
-

yes | no -

-
-

Add the diagnostics to the assertion results

-
-

terminate

-
-

yes | no | true | false | assert -

-
-

Terminate on the first failed assertion or - successful report

-
-

message-newline -

-
-

"true" (default) | "false" -

-
-

Generate an extra newline at the end of messages

-
-

output-encoding

-
-

string

-
-

The encoding used for output, for example if the - output is XML

-
-
-
-
- + + + + + The ISO Schematron Skeleton API + + + + + +

API for ISO Schematron Skeleton

+



+

+

Rick Jelliffe, 2010/04/14

+

This document provides documentation on the XSLT API available in +the implementation of Schematron called iso_schematron_skeleton.xsl. +(available in an XSLT1 and XSLT2 version). The API makes available as +much information from the schema, however there may be some edge +cases where it is not exhaustive. +

+

The skeleton is an XSLT script which provides all the basic +parsing and validating routines for compiling a Schematron schema +into XSLT. Schematron was designed to allow many different uses, and +the skeleton gives you a headstart in creating a customized +implementation. You just need to write XSLT templates to override the +default ones. (The program you write is sometimes called a +meta-stylesheet.) It is the meta-stylesheet that is called +as the XSLT script, not the skeleton. There are several +pre-processing stages which the Schematron schema should be processed +through first, to handle such things as include statements and +abstract patterns. +

+

Phases and error reporting for problems in the schema itself are +handled by the skeleton with no interaction with a “meta-stylesheet”. +Note that there is no guarantee that the context node is always the +element being handled: in most cases the only information available +is the information in the parameters. +

+

For an introductory tutorial on using this API, see Bob DuCharme's +Schematron 1.5: +Looking Under the Hood +

+

Superset of API for Schematron 1.5 and 1.6

+

(This is an updated version of the API for the Schematron 1.5 +implementation called skeleton1-5.xsl, which in turn comes +from the new architecture contributed by Oliver Becker for +Schematron 1.3.)

+

The current API contains only additions. Well-written +meta-stylesheets that use the new API will be be able to run on the +existing 1.5 and 1.6 skeletons. Similarly, it should be possible to +upgrade the skeleton from 1.5 or 1.6 to the iso-schematron-skeleton +only by correcting the import statement at the beginning of the +meta-stylsheet. Additions or re-groupings from the 1.5 schema are +shown in red. Deletions have overstrike.

+

Mooted addition: a parameter @action which for specifying +processing instructions on assertions and reports.

+
+

process-prolog

+

The process-prolog template gets called at the start of +the validation session. It has no parameters. The default +implementation is no action.

+
+

process-root

+

The process-root template processes the root element of +the schema (which is not the same thing as the root of the document / +and need not be the document element /*) .

+
+
node-list $contents +
+ string $schemaVersion +
+ The version of the schema, perhaps a datestamp. +
+ "xslt" | "xpath" | + "xslt2" | ... + $queryBinding +
+ The query language binding. +
+ string $title +
+ The title of this schema +
+ "iso" | "1.5" | + "1.6" | ... + $version +
+ The version of Schematron being used. +
+

+Rich properties:

+
+
XML SystemId + $icon +
+ The URI of an icon +
+ XML ID + $id +
+ The unique identifier with the schema for the + schema + element. +
+ SGML FPI + $fpi +
+ The Formal Public Identifier for this schema. +
+ IETF language + $lang +
+ The human language used in this schema, from + xml:lang +
+ URL + $see +
+ Link to documentation on WWW or file +
+ "preserve" | "default" + $space +
+ The value for xml:space +
+

+To print the documentation paragraphs, use <xsl:apply-templates +mode="do-schema-p" />

+

To output the results, use <xsl:copy-of select="$contents" +/>

+
+

process-assert

+

The process-assert template handles asserts whose test +has failed. +

+
+
XPath $test +
+ The test +
+ XML IDREFS $diagnostics +
+ A list of the idrefs diagnostic elements related to the current + assertion +
+ XML NMTOKEN + $flag +
+ The name of a flag that becomes true because + this assertion fails. The flag is true for the document if it is + flagged true on any assertion. For compatability, this parameter + should not be used with Schematron 1.5. +
+

+Rich properties:

+
+
XML SystemId + $icon +
+ The URI of an icon +
+ XML ID + $id +
+ The unique identifier with the schema for the + assert + element. +
+ SGML FPI + $fpi +
+ The Formal Public Identifier for this + assertion. +
+ IETF language + $lang +
+ The human language used in this assertion, + from xml:lang +
+ URL + $see +
+ Link to documentation on WWW or file +
+ "preserve" | "default" + $space +
+ The value for xml:space +
+

+Linking properties:

+
+
XML NMTOKEN + $role +
+ A name for the generic role of this assertion. + The schema creator would have their own vocabulary. +
+ XPath + $subject +
+ A path relative to the current context to some + interesting node considered the subject. +
+

+To print the text contents, use <xsl:apply-templates +mode="text" />

+
+

process-diagnostic

+

The process-diagnostic template handles diagnostic +messages for assert statements that have failed and report +statements that have succeeded. The diagnostics are evaluated in the +context of the rule.

+

Rich properties:

+
+
XML SystemId + $icon +
+ The URI of an icon +
+ XML ID + $id +
+ The unique identifier with the schema for the + assert + element. +
+ SGML FPI + $fpi +
+ The Formal Public Identifier for this + assertion. +
+ IETF language + $lang +
+ The human language used in this assertion, + from xml:lang +
+ URL + $see +
+ Link to documentation on WWW or file +
+ "preserve" | "default" + $space +
+ The value for xml:space +

+
+

process-dir

+

The process-dir template handles bi-directionality +markup, which is only needed by certain human scripts such as Arabic.

+
+
"ltr" or "rtl" or "" + $value +
+ Left-to-right or right-to-left or unspecified +

+
+

process-emph

+

The process-emph template handles the markup of +emphasized text in paragraphs, assertions and diagnostics. It has no +parameters.

+
+

process-message

+

The process-message handles default outputing of text.

+
+
string $pattern +
+ Some text that may be some kind of pattern +
+ string $role +
+ Some text that may be some kind of role +

+
+

process-name

+

The process-name templates handle name strings that can +be used in assertions. asssert and report only +provide name subelements rather than the more general +value-of elements to encourage plain language and generic +descriptions rather than specific diagnostics, for which purpose the +diagnostics elements are used.

+
+
string $name +
+ The name of the current element, or of the node specified by a name + element +

+
+

process-ns

+

The process-ns template reports on ns +declarations, which are used to transmit on namespace information by +the skeleton.

+
+
Namespace NCName $prefix +
+ The prefix of a namespace +
+ XML SystemId $uri +
+ The (internationalized) URI Reference of a namespace +

+
+

process-p

+

The process-p template handles paragraphs.

+
+
XML NMTOKEN $class +
+ An attribute that can be used for stylesheet style +
+ XML ID $id +
+ The unique identifier with the schema for the p element. +
+ XML SystemId $icon +
+ The URI of an icon +
+ IETF Language $lang +
+ The human language used in this paragraph +
+

+To print the text contents, use <xsl:apply-templates +mode="text" /> +

+
+

process-pattern

+

The process-pattern reports on the start of evaluation of +a pattern element.

+
+
string $name +
+ The title of the current pattern +
+ XML NCNAMES $is-a +
+ Empty or not provided if the pattern is not derived from an abstract + pattern. Otherwise the name of the abstract pattern. A list may be + used if there was a sequence of abstract patterns. +
+

+Rich properties:

+
+
XML SystemId + $icon +
+ The URI of an icon +
+ XML ID + $id +
+ The unique identifier with the schema for the + pattern + element. +
+ SGML FPI + $fpi +
+ The Formal Public Identifier for this pattern. + +
+ IETF language + $lang +
+ The human language used in this pattern, from + xml:lang +
+ URL + $see +
+ A (internationalized) URI reference to some + supporting or defining documentation +
+ "preserve" | "default" + $space +
+ The value for xml:space +
+

+To print the documentation contents, use <xsl:apply-templates +mode="do-pattern-p"/>

+
+

process-report

+

The process-report template handles report whose +test has succeeded. +

+
+
XPath $test +
+ The test +
+ XML IDREFS $diagnostics +
+ A list of the diagnostic elements related to the current assertion +
+ XML NMTOKEN + $flag +
+ The name of a flag that becomes true because + this assertion fails. The flag is true for the document if it is + flagged true on any assertion. For compatability, this parameter + should not be used with Schematron 1.5. +
+

+Rich properties:

+
+
XML SystemId + $icon +
+ The URI of an icon +
+ XML ID + $id +
+ The unique identifier with the schema for the + report + element. +
+ SGML FPI + $fpi +
+ The Formal Public Identifier for this report. +
+ IETF language + $lang +
+ The human language used in this report, from + xml:lang +
+ URL + $see +
+ Link to documentation on WWW or file +
+ "preserve" | "default" + $space +
+ The value for xml:space +
+

+Linking properties:

+
+
XML NMTOKEN + $role +
+ A name for the generic role of this assertion. + The schema creator would have their own vocabulary. +
+ XPath + $subject +
+ A path relative to the current context to some + interesting node considered the subject. +
+

+To print the text contents, use <xsl:apply-templates +mode="text" />

+
+

process-rule

+

The process-rule reports that a rule element has +fired: its context attribute matched some nodes. .

+
+
XSLT expression $context +
+ The expression that gives the context of the current +
+

+Rich properties:

+
+
XML SystemId + $icon +
+ The URI of an icon +
+ XML ID + $id +
+ The unique identifier with the schema for this + rule + element. +
+ SGML FPI + $fpi +
+ The Formal Public Identifier for this rule. +
+ IETF language + $lang +
+ The human language used in this rule, from + xml:lang +
+ URL + $see +
+ Link to documentation on WWW or file +
+ "preserve" | "default" + $space +
+ The value for xml:space +
+

+Linking properties:

+
+
XML NMTOKEN + $role +
+ A name for the generic role of this assertion. + The schema creator would have their own vocabulary. +
+ XPath + $subject +
+ A path relative to the current context to some + interesting node considered the subject. +

+
+

process-span

+

The process-span handles span elements, which are generic +elements for styling, like HTML's .

+
+
XML NMTOKEN $class +
+ An attribute that can be used for stylesheet style +

+
+

process-title

+

The process-title handles title elements, which are +generic elements for styling, like HTML's .

+
+
XML NMTOKEN $class +
+ An attribute that can be used for stylesheet style +
+

+By default, titles are handled by invocing process-p with +the parameter class with a value "title".

+
+

process-value-of

+

The process-value-of template handles value-of +elements, which are used in diagnostic messages to allow very +specific hinting .

+
+
XPath $select +
+ The path of some node that will be evaluated and printed.

+
+

Global Parameters

+

There are several global parameters that may be available for use. +However, it is not a requirement to follow these, and implementations +may not supply them with any value. So a test of +string-length(variable) < +0 is appropriate in each case.

+



+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Parameter

+
+

Value

+
+

Description

+
+

allow-foreign

+
+

"true" | "false" (default) +

+
+

Pass non-Schematron elements to the generated + stylesheet. Pass the Schematron elements span, emph and dir: to + the output SVRL. +

+
+

fileNameParameter

+
+

string

+
+

A parameter passed to the Validator and + potentially available as a variable in Schematron schemas as + $fileNameParameter

+
+

fileDirParameter

+
+

string

+
+

A parameter passed to the Validator and + potentially available as a variable in Schematron schemas as + $fileDirParameter

+
+

archiveNamePaameter

+
+

string

+
+

A parameter passed to the Validator and + potentially available as a variable in Schematron schemas as + $archiveNameParameter

+
+

archiveDirParameter

+
+

string

+
+

A parameter passed to the Validator and + potentially available as a variable in Schematron schemas as + $archivePathParameter

+
+

debug +

+
+

true” | “false” (default)

+
+

Verbose error messages (Note this may be + superceded by “verbose” at some stage in the future.)

+
+

generate-paths

+
+

true|false +

+
+

generate the SVRL @location attribute with XPaths

+
+

diagnose

+
+

yes | no +

+
+

Add the diagnostics to the assertion results

+
+

terminate

+
+

yes | no | true | false | assert +

+
+

Terminate on the first failed assertion or + successful report

+
+

message-newline +

+
+

"true" (default) | "false" +

+
+

Generate an extra newline at the end of messages

+
+

output-encoding

+
+

string

+
+

The encoding used for output, for example if the + output is XML

+
+
+
+
+ \ No newline at end of file diff --git a/content/schematron.xqm b/content/schematron.xqm index c6843e2..6cd2338 100644 --- a/content/schematron.xqm +++ b/content/schematron.xqm @@ -1,10 +1,13 @@ -(:~ +xquery version "3.1"; +(:~ : Schematron module for eXist - : + : : @author Vincent M. Lizzi + : @author Duncan Paterson : @see LICENSE (The MIT License) : @see http://exist-db.org/ : @see http://github.com/Schematron/schematron-exist + : @version 2.0.0 :) module namespace _ = "http://github.com/Schematron/schematron-exist"; @@ -12,28 +15,34 @@ module namespace _ = "http://github.com/Schematron/schematron-exist"; declare namespace sch = "http://purl.oclc.org/dsdl/schematron"; declare namespace svrl = "http://purl.oclc.org/dsdl/svrl"; declare namespace xsl = "http://www.w3.org/1999/XSL/Transform"; +declare namespace xmldb = "http://exist-db.org/xquery/xmldb"; -declare variable $_:include := "/db/apps/schematron-exist/content/iso-schematron/iso_dsdl_include.xsl"; -declare variable $_:expand := "/db/apps/schematron-exist/content/iso-schematron/iso_abstract_expand.xsl"; -declare variable $_:compile1 := "/db/apps/schematron-exist/content/iso-schematron/iso_svrl_for_xslt1.xsl"; -declare variable $_:compile2 := "/db/apps/schematron-exist/content/iso-schematron/iso_svrl_for_xslt2.xsl"; +(: TODO: make this a computed path :) +declare variable $_:path := '/db/system/repo/schematron-exist-2.0.0/content/iso-schematron/'; + +declare variable $_:include := $_:path || "iso_dsdl_include.xsl"; +declare variable $_:expand := $_:path || "iso_abstract_expand.xsl"; +declare variable $_:compile1 := $_:path || "iso_svrl_for_xslt1.xsl"; +declare variable $_:compile2 := $_:path || "iso_svrl_for_xslt2.xsl"; declare variable $_:error := ('error', 'fatal'); declare variable $_:warn := ('warn', 'warning'); declare variable $_:info := ('info', 'information'); -(:~ - : Compile a given Schematron file so that it can be used to validate documents. +(:~ + : Compile a given Schematron file so that it can be used to validate documents. + : @return a compiled schematron file :) declare function _:compile($schematron) as node() { _:compile($schematron, () ) }; -(:~ - : Compile a given Schematron file using given parameters so that it can be used to validate documents. +(:~ + : Compile a given Schematron file using given parameters so that it can be used to validate documents. + : @return a compiled schematron file :) declare function _:compile($schematron, $params) as node() { - let $p := typeswitch ($params) + let $p := typeswitch ($params) case xs:string return default return $params let $step1 := transform:transform($schematron, doc($_:include), $p) @@ -42,15 +51,17 @@ declare function _:compile($schematron, $params) as node() { return $step3 }; -(:~ - : Validate a given document using a compiled Schematron. Returns SVRL validation result. +(:~ + : Validate a given document using a compiled Schematron. + : @return SVRL validation result. :) declare function _:validate($document as node(), $compiledSchematron as node()) as node() { transform:transform($document, $compiledSchematron, ()) }; -(:~ +(:~ : Check whether a SVRL validation result indicates valid in a pass/fail sense. + : @return true if passing, fail otherwise :) declare function _:is-valid($svrl) as xs:boolean { boolean($svrl[descendant::svrl:fired-rule]) and @@ -59,27 +70,27 @@ declare function _:is-valid($svrl) as xs:boolean { ])) }; -(:~ +(:~ : Check whether a SVRL validation result contains any error, warning, or informational messages. :) declare function _:has-messages($svrl) as xs:boolean { boolean(($svrl//svrl:failed-assert union $svrl//svrl:successful-report)) }; -(:~ +(:~ : Return messages from a SVRL validation result. :) declare function _:messages($svrl) as item()* { ($svrl//svrl:failed-assert union $svrl//svrl:successful-report) }; -(:~ - : Return severity (error, warn, info) of a message based on the role attribute. - : Variations are standardized: - : 'error' and 'fatal' return 'error', - : 'warn' and 'warning' returns 'warn', +(:~ + : Return severity (error, warn, info) of a message based on the role attribute. + : Variations are standardized: + : 'error' and 'fatal' return 'error', + : 'warn' and 'warning' returns 'warn', : 'info' and 'information' returns 'info' - : If the role attribute value is unrecognized the value is returned unchanged. + : If the role attribute value is unrecognized the value is returned unchanged. :) declare function _:message-level($message) as xs:string { if ($message[not(@role) or @role = $_:error]) then $_:error[1] diff --git a/content/test/0001-compile-validate/0001.sch b/content/test/0001-compile-validate/0001.sch deleted file mode 100644 index 1cd8596..0000000 --- a/content/test/0001-compile-validate/0001.sch +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/content/test/0001-compile-validate/0001.xml b/content/test/0001-compile-validate/0001.xml deleted file mode 100644 index 6cc709c..0000000 --- a/content/test/0001-compile-validate/0001.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/content/test/0001-compile-validate/0001.xqm b/content/test/0001-compile-validate/0001.xqm deleted file mode 100644 index dc43001..0000000 --- a/content/test/0001-compile-validate/0001.xqm +++ /dev/null @@ -1,21 +0,0 @@ -module namespace _ = "0001"; - -import module namespace s = "http://github.com/Schematron/schematron-exist" at "../../schematron.xqm"; - -declare namespace svrl="http://purl.oclc.org/dsdl/svrl"; -declare namespace xsl="http://www.w3.org/1999/XSL/Transform"; -declare namespace test="http://exist-db.org/xquery/xqsuite"; - - -declare %test:assertExists function _:compile() { - let $c := s:compile(doc('0001.sch')) - return $c[self::xsl:stylesheet] -}; - -declare %test:assertExists function _:validationResult() { - let $c := s:compile(doc('0001.sch')) - let $r := s:validate(doc('0001.xml'), $c) - return $r[self::svrl:schematron-output] -}; - - diff --git a/content/test/0002-basic-pass-fail/0002-invalid.xml b/content/test/0002-basic-pass-fail/0002-invalid.xml deleted file mode 100644 index 71a8947..0000000 --- a/content/test/0002-basic-pass-fail/0002-invalid.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - Schematron for eXist -

This is a test of running ISO Schematron in eXist

-

-
diff --git a/content/test/0002-basic-pass-fail/0002-valid.xml b/content/test/0002-basic-pass-fail/0002-valid.xml deleted file mode 100644 index a65aba0..0000000 --- a/content/test/0002-basic-pass-fail/0002-valid.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - Schematron for eXist -

This is a test of running ISO Schematron in eXist

-
diff --git a/content/test/0002-basic-pass-fail/0002.sch b/content/test/0002-basic-pass-fail/0002.sch deleted file mode 100644 index e94e05e..0000000 --- a/content/test/0002-basic-pass-fail/0002.sch +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - title should be followed by a p (paragraph) element - - - - - p (paragraph) should not be empty - - - - - \ No newline at end of file diff --git a/content/test/0002-basic-pass-fail/0002.xqm b/content/test/0002-basic-pass-fail/0002.xqm deleted file mode 100644 index 8388484..0000000 --- a/content/test/0002-basic-pass-fail/0002.xqm +++ /dev/null @@ -1,25 +0,0 @@ -module namespace _ = "0002"; - -import module namespace s = "http://github.com/Schematron/schematron-exist" at "../../schematron.xqm"; - -declare namespace test="http://exist-db.org/xquery/xqsuite"; - -declare %test:assertTrue function _:valid() { - let $r := s:validate(doc('0002-valid.xml'), s:compile(doc('0002.sch'))) - return s:is-valid($r) -}; - -declare %test:assertFalse function _:invalid() { - let $r := s:validate(doc('0002-invalid.xml'), s:compile(doc('0002.sch'))) - return s:is-valid($r) -}; - -declare %test:assertEmpty function _:valid-messages() { - let $r := s:messages(s:validate(doc('0002-valid.xml'), s:compile(doc('0002.sch')))) - return $r -}; - -declare %test:assertEquals(1) function _:invalid-messages() { - let $r := s:messages(s:validate(doc('0002-invalid.xml'), s:compile(doc('0002.sch')))) - return count($r) -}; diff --git a/content/test/0003-no-fired-rules/0003.sch b/content/test/0003-no-fired-rules/0003.sch deleted file mode 100644 index 717f44f..0000000 --- a/content/test/0003-no-fired-rules/0003.sch +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/content/test/0003-no-fired-rules/0003.xml b/content/test/0003-no-fired-rules/0003.xml deleted file mode 100644 index ce168ad..0000000 --- a/content/test/0003-no-fired-rules/0003.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/content/test/0003-no-fired-rules/0003.xqm b/content/test/0003-no-fired-rules/0003.xqm deleted file mode 100644 index 260994e..0000000 --- a/content/test/0003-no-fired-rules/0003.xqm +++ /dev/null @@ -1,12 +0,0 @@ -module namespace _ = "0003"; - -import module namespace s = "http://github.com/Schematron/schematron-exist" at "../../schematron.xqm"; - -declare namespace test="http://exist-db.org/xquery/xqsuite"; - -(:~ Expect validation to fail if the Schematron doesn't match anything in the document. :) -declare %test:assertFalse function _:test() { - let $c := s:compile(doc('0003.sch')) - let $r := s:validate(doc('0003.xml'), $c) - return s:is-valid($r) -}; diff --git a/content/test/0004-phases/0004.sch b/content/test/0004-phases/0004.sch deleted file mode 100644 index 032b403..0000000 --- a/content/test/0004-phases/0004.sch +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - Pass Valid - - - - - - - - Fail Invalid - - - - - - \ No newline at end of file diff --git a/content/test/0004-phases/0004.xml b/content/test/0004-phases/0004.xml deleted file mode 100644 index 6cc709c..0000000 --- a/content/test/0004-phases/0004.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/content/test/0004-phases/0004.xqm b/content/test/0004-phases/0004.xqm deleted file mode 100644 index 176aea2..0000000 --- a/content/test/0004-phases/0004.xqm +++ /dev/null @@ -1,32 +0,0 @@ -module namespace _ = "0004"; - -import module namespace s = "http://github.com/Schematron/schematron-exist" at "../../schematron.xqm"; - -declare namespace test="http://exist-db.org/xquery/xqsuite"; - -declare %test:assertTrue function _:phase1() { - let $p := - let $s := s:compile(doc('0004.sch'), $p) - let $r := s:validate(doc('0004.xml'), $s) - return s:is-valid($r) -}; - -declare %test:assertFalse function _:phase2() { - let $p := - let $s := s:compile(doc('0004.sch'), $p) - let $r := s:validate(doc('0004.xml'), $s) - return s:is-valid($r) -}; - -declare %test:assertTrue function _:phase1string() { - let $s := s:compile(doc('0004.sch'), 'phase1') - let $r := s:validate(doc('0004.xml'), $s) - return s:is-valid($r) -}; - -declare %test:assertFalse function _:phase2string() { - let $s := s:compile(doc('0004.sch'), 'phase2') - let $r := s:validate(doc('0004.xml'), $s) - return s:is-valid($r) -}; - diff --git a/content/test/0005-example-1/0005.xqm b/content/test/0005-example-1/0005.xqm deleted file mode 100644 index 76bfc82..0000000 --- a/content/test/0005-example-1/0005.xqm +++ /dev/null @@ -1,68 +0,0 @@ -module namespace _ = "0005"; - -import module namespace s = "http://github.com/Schematron/schematron-exist" at "../../schematron.xqm"; - -declare namespace test="http://exist-db.org/xquery/xqsuite"; - -declare %test:assertEquals( - 'false', - 'true', - 4, - 'info', - 'info', - 'warn', - 'error', - '/document/title', - 'short section has fewer than 3 paragraphs', - '/document/p[2]', - 'p (paragraph) should not be empty' - ) function _:example1a() { - let $sch := s:compile(doc('example-1.sch')) - let $svrl := s:validate(doc('example-1a.xml'), $sch) - return ( - s:is-valid($svrl), - s:has-messages($svrl), - count(s:messages($svrl)), - s:message-level(s:messages($svrl)[1]), - s:message-level(s:messages($svrl)[2]), - s:message-level(s:messages($svrl)[3]), - s:message-level(s:messages($svrl)[4]), - s:message-location(s:messages($svrl)[3]), - normalize-space(s:message-description(s:messages($svrl)[3])), - s:message-location(s:messages($svrl)[4]), - normalize-space(s:message-description(s:messages($svrl)[4])) - ) -}; - -declare %test:assertEquals( - 'true', - 'true', - 3, - 'info', - 'info', - 'warn', - '/document/title', - 'short section has fewer than 3 paragraphs' - ) function _:example1b() { - let $sch := s:compile(doc('example-1.sch')) - let $svrl := s:validate(doc('example-1b.xml'), $sch) - return ( - s:is-valid($svrl), - s:has-messages($svrl), - count(s:messages($svrl)), - s:message-level(s:messages($svrl)[1]), - s:message-level(s:messages($svrl)[2]), - s:message-level(s:messages($svrl)[3]), - s:message-location(s:messages($svrl)[3]), - normalize-space(s:message-description(s:messages($svrl)[3])) - ) -}; - -declare %test:assertEquals('true', 'false') function _:example1c() { - let $sch := s:compile(doc('example-1.sch')) - let $svrl := s:validate(doc('example-1c.xml'), $sch) - return ( - s:is-valid($svrl), - s:has-messages($svrl) - ) -}; diff --git a/content/test/0005-example-1/example-1.sch b/content/test/0005-example-1/example-1.sch deleted file mode 100644 index 962d2ef..0000000 --- a/content/test/0005-example-1/example-1.sch +++ /dev/null @@ -1,26 +0,0 @@ - - - - - title - paragraph - - - always true - - - always false - - - short section has fewer than 3 paragraphs - - - - - p (paragraph) should not be empty - - - - - \ No newline at end of file diff --git a/content/test/0005-example-1/example-1.xq b/content/test/0005-example-1/example-1.xq deleted file mode 100644 index 079848f..0000000 --- a/content/test/0005-example-1/example-1.xq +++ /dev/null @@ -1,39 +0,0 @@ -import module namespace schematron = "http://github.com/Schematron/schematron-exist" at "/db/apps/schematron-exist/content/schematron.xqm"; - -let $sch := schematron:compile(doc('example-1.sch')) -for $file in ('example-1a.xml', 'example-1b.xml', 'example-1c.xml') -let $svrl := schematron:validate(doc($file), $sch) -return ( - concat('*** ', $file, ' ***'), - if (schematron:is-valid($svrl)) then 'Valid!' else 'Not valid!', - if (schematron:has-messages($svrl)) then - for $message in schematron:messages($svrl) - return concat( - schematron:message-level($message) - , ': ', - schematron:message-description($message) - , ' (location: ', - schematron:message-location($message) - , ')' - ) - else 'No messages were reported' -) - -(: OUTPUT: - -*** example-1a.xml *** -Not valid! -info: always true (location: /document/title) -info: always false (location: /document/title) -warn: short section has fewer than 3 paragraphs (location: /document/title) -error: p (paragraph) should not be empty (location: /document/p[2]) -*** example-1b.xml *** -Valid! -info: always true (location: /document/title) -info: always false (location: /document/title) -warn: short section has fewer than 3 paragraphs (location: /document/title) -*** example-1c.xml *** -Valid! -No messages were reported - -:) \ No newline at end of file diff --git a/content/test/0005-example-1/example-1a.xml b/content/test/0005-example-1/example-1a.xml deleted file mode 100644 index 71a8947..0000000 --- a/content/test/0005-example-1/example-1a.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - Schematron for eXist -

This is a test of running ISO Schematron in eXist

-

-
diff --git a/content/test/0005-example-1/example-1b.xml b/content/test/0005-example-1/example-1b.xml deleted file mode 100644 index a65aba0..0000000 --- a/content/test/0005-example-1/example-1b.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - Schematron for eXist -

This is a test of running ISO Schematron in eXist

-
diff --git a/content/test/0005-example-1/example-1c.xml b/content/test/0005-example-1/example-1c.xml deleted file mode 100644 index 78c5fd6..0000000 --- a/content/test/0005-example-1/example-1c.xml +++ /dev/null @@ -1,4 +0,0 @@ - - -

This is a test of running ISO Schematron in eXist

-
diff --git a/dist/schematron-exist-1.0.xar b/dist/schematron-exist-1.0.xar deleted file mode 100644 index ca6e0f8..0000000 Binary files a/dist/schematron-exist-1.0.xar and /dev/null differ diff --git a/dist/schematron-exist-1.1.xar b/dist/schematron-exist-1.1.xar deleted file mode 100644 index 348f9f1..0000000 Binary files a/dist/schematron-exist-1.1.xar and /dev/null differ diff --git a/expath-pkg.xml b/expath-pkg.xml index afe4993..c26843e 100644 --- a/expath-pkg.xml +++ b/expath-pkg.xml @@ -1,13 +1,25 @@ - - Schematron for eXist-db - - - http://github.com/Schematron/schematron-exist - schematron.xqm - - \ No newline at end of file + + Schematron for eXist-db + + + http://github.com/Schematron/schematron-exist/iso_dsdl_include.xsl + iso_dsdl_include.xsl + + + http://github.com/Schematron/schematron-exist/iso_abstract_expand.xsl + iso_abstract_expand.xsl + + + http://github.com/Schematron/schematron-exist/iso_svrl_for_xslt1.xsl + iso_svrl_for_xslt1.xsl + + + http://github.com/Schematron/schematron-exist/iso_svrl_for_xslt2.xsl + iso_svrl_for_xslt2.xsl + + + http://github.com/Schematron/schematron-exist + schematron.xqm + + diff --git a/repo.xml b/repo.xml index 53f04e9..c292590 100644 --- a/repo.xml +++ b/repo.xml @@ -2,12 +2,10 @@ Library module to use ISO Schematron in eXist Vincent M. Lizzi + Duncan Paterson https://github.com/Schematron/schematron-exist stable The MIT License true library - schematron-exist - - - \ No newline at end of file + diff --git a/test/0001-compile-validate/0001.xqm b/test/0001-compile-validate/0001.xqm new file mode 100644 index 0000000..a422662 --- /dev/null +++ b/test/0001-compile-validate/0001.xqm @@ -0,0 +1,35 @@ +module namespace _ = "0001"; + +import module namespace s = "http://github.com/Schematron/schematron-exist"; + +declare namespace svrl="http://purl.oclc.org/dsdl/svrl"; +declare namespace xsl="http://www.w3.org/1999/XSL/Transform"; +declare namespace test="http://exist-db.org/xquery/xqsuite"; + +declare variable $_:schema := document { + + + +}; + +declare variable $_:xml := document { + +}; + + +declare +%test:assertExists +%test:name('compile empty schema') +function _:compile() { + let $c := s:compile($_:schema) + return $c[self::xsl:stylesheet] +}; + +declare +%test:assertExists +%test:name('validate empty document') +function _:validationResult() { + let $c := s:compile($_:schema) + let $r := s:validate($_:xml, $c) + return $r[self::svrl:schematron-output] +}; diff --git a/test/0002-basic-pass-fail/0002.xqm b/test/0002-basic-pass-fail/0002.xqm new file mode 100644 index 0000000..1ecff17 --- /dev/null +++ b/test/0002-basic-pass-fail/0002.xqm @@ -0,0 +1,69 @@ +module namespace _ = "0002"; + +import module namespace s = "http://github.com/Schematron/schematron-exist"; + +declare namespace test="http://exist-db.org/xquery/xqsuite"; + +declare variable $_:schema := document { + + + + + title should be followed by a p (paragraph) element + + + + + p (paragraph) should not be empty + + + + +}; + +declare variable $_:valid := document { + + Schematron for eXist +

This is a test of running ISO Schematron in eXist

+
+}; + +declare variable $_:invalid := document { + + Schematron for eXist +

This is a test of running ISO Schematron in eXist

+

+ +}; + +declare +%test:assertTrue +%test:name('simple pass') +function _:valid() { + let $r := s:validate($_:valid, s:compile($_:schema)) + return s:is-valid($r) +}; + +declare +%test:assertFalse +%test:name('simple fail') +function _:invalid() { + let $r := s:validate($_:invalid, s:compile($_:schema)) + return s:is-valid($r) +}; + +declare +%test:assertEmpty +%test:name('valid message') +function _:valid-messages() { + let $r := s:messages(s:validate($_:valid, s:compile($_:schema))) + return $r +}; + +declare +%test:assertEquals(1) +%test:name('invalid message') +function _:invalid-messages() { + let $r := s:messages(s:validate($_:invalid, s:compile($_:schema))) + return count($r) +}; diff --git a/test/0003-no-fired-rules/0003.xqm b/test/0003-no-fired-rules/0003.xqm new file mode 100644 index 0000000..a708626 --- /dev/null +++ b/test/0003-no-fired-rules/0003.xqm @@ -0,0 +1,31 @@ +module namespace _ = "0003"; + +import module namespace s = "http://github.com/Schematron/schematron-exist"; + +declare namespace test="http://exist-db.org/xquery/xqsuite"; + +declare variable $_:schema := document { + + + + + + + +}; + +declare variable $_:xml := document { + + + +}; + +(:~ Expect validation to fail if the Schematron doesn't match anything in the document. :) +declare +%test:assertFalse +%test:name('No rules fail for 0 matches') +function _:test() { + let $c := s:compile($_:schema) + let $r := s:validate($_:xml, $c) + return s:is-valid($r) +}; diff --git a/test/0004-phases/0004.xqm b/test/0004-phases/0004.xqm new file mode 100644 index 0000000..d36354d --- /dev/null +++ b/test/0004-phases/0004.xqm @@ -0,0 +1,71 @@ +module namespace _ = "0004"; + +import module namespace s = "http://github.com/Schematron/schematron-exist"; + +declare namespace test="http://exist-db.org/xquery/xqsuite"; +declare variable $_:schema := document { + + + + + + + + + + + Pass Valid + + + + + + + Fail Invalid + + + + +}; + +declare variable $_:xml := document { + +}; + +declare +%test:assertTrue +%test:name('phase parameter pass') +function _:phase1() { + let $p := + let $s := s:compile($_:schema, $p) + let $r := s:validate($_:xml, $s) + return s:is-valid($r) +}; + +declare +%test:assertFalse +%test:name('phase parameter fail') +function _:phase2() { + let $p := + let $s := s:compile($_:schema, $p) + let $r := s:validate($_:xml, $s) + return s:is-valid($r) +}; + +declare +%test:assertTrue +%test:name('string parameter pass') +function _:phase1string() { + let $s := s:compile($_:schema, 'phase1') + let $r := s:validate($_:xml, $s) + return s:is-valid($r) +}; + +declare +%test:assertFalse +%test:name('string parameter fail') +function _:phase2string() { + let $s := s:compile($_:schema, 'phase2') + let $r := s:validate($_:xml, $s) + return s:is-valid($r) +}; diff --git a/test/0005-example-1/0005.xqm b/test/0005-example-1/0005.xqm new file mode 100644 index 0000000..9297bb7 --- /dev/null +++ b/test/0005-example-1/0005.xqm @@ -0,0 +1,123 @@ +module namespace _ = "0005"; + +import module namespace s = "http://github.com/Schematron/schematron-exist" at "../../schematron.xqm"; + +declare namespace test="http://exist-db.org/xquery/xqsuite"; + +declare variable $_:schema := document { + + + title + paragraph + + + always true + + + always false + + + short section has fewer than 3 paragraphs + + + + + p (paragraph) should not be empty + + + + +}; + +declare variable $_:xml1 := document { + + Schematron for eXist +

This is a test of running ISO Schematron in eXist

+

+ +}; + +declare variable $_:xml2 := document { + + Schematron for eXist +

This is a test of running ISO Schematron in eXist

+
+}; + +declare variable $_:xml3 := document { + +

This is a test of running ISO Schematron in eXist

+
+}; + +declare +%test:assertEquals( + 'false', + 'true', + 4, + 'info', + 'info', + 'warn', + 'error', + '/document/title', + 'short section has fewer than 3 paragraphs', + '/document/p[2]', + 'p (paragraph) should not be empty' + ) +%test:name('message has info, warn, and error') +function _:example1a() { + let $sch := s:compile($_:schema) + let $svrl := s:validate($_:xml1, $sch) + return ( + s:is-valid($svrl), + s:has-messages($svrl), + count(s:messages($svrl)), + s:message-level(s:messages($svrl)[1]), + s:message-level(s:messages($svrl)[2]), + s:message-level(s:messages($svrl)[3]), + s:message-level(s:messages($svrl)[4]), + s:message-location(s:messages($svrl)[3]), + normalize-space(s:message-description(s:messages($svrl)[3])), + s:message-location(s:messages($svrl)[4]), + normalize-space(s:message-description(s:messages($svrl)[4])) + ) +}; + +declare +%test:assertEquals( + 'true', + 'true', + 3, + 'info', + 'info', + 'warn', + '/document/title', + 'short section has fewer than 3 paragraphs' + ) +%test:name('valid with info and warning') +function _:example1b() { + let $sch := s:compile($_:schema) + let $svrl := s:validate($_:xml2, $sch) + return ( + s:is-valid($svrl), + s:has-messages($svrl), + count(s:messages($svrl)), + s:message-level(s:messages($svrl)[1]), + s:message-level(s:messages($svrl)[2]), + s:message-level(s:messages($svrl)[3]), + s:message-location(s:messages($svrl)[3]), + normalize-space(s:message-description(s:messages($svrl)[3])) + ) +}; + +declare +%test:assertEquals('true', 'false') +%test:name('validate schematron without messages') +function _:example1c() { + let $sch := s:compile($_:schema) + let $svrl := s:validate($_:xml3, $sch) + return ( + s:is-valid($svrl), + s:has-messages($svrl) + ) +}; diff --git a/content/test/test-suite.xq b/test/test-suite.xq similarity index 95% rename from content/test/test-suite.xq rename to test/test-suite.xq index 97fbd87..69e4660 100644 --- a/content/test/test-suite.xq +++ b/test/test-suite.xq @@ -1,4 +1,4 @@ -xquery version "3.0"; +xquery version "3.1"; import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; diff --git a/test/test.bats b/test/test.bats new file mode 100644 index 0000000..826bfb3 --- /dev/null +++ b/test/test.bats @@ -0,0 +1,28 @@ +#!/usr/bin/env bats + + +# https://github.com/bats-core/bats-core#printing-to-the-terminal + +@test "Testuite reports no failures or errors" { + run xmllint --xpath '//@failures > 0 or //@errors > 0' test/result/*.xml + [ "$status" -eq 0 ] + [ "$output" = false ] +} + +@test "No testcase failures" { + run xmllint --xpath "//failure/../../*" test/result/*.xml + for FAIL in ${output} + do + echo "# " ${FAIL} >&3 + done + [ "$output" = 'XPath set is empty' ] +} + +@test "No testcase errors" { + run xmllint --xpath "//error/../../*" test/result/*.xml + for ERR in ${output} + do + echo "# " ${ERR} >&3 + done + [ "$output" = 'XPath set is empty' ] +}