-
- 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' ]
+}