├── .gitignore ├── example ├── stf-errors │ └── nogo │ │ ├── foo-2.xml │ │ └── foo-1.xml ├── README.md ├── example.sch └── build.xml ├── properties.xml ├── COPYING ├── stf.properties.xml ├── iso-schematron-xslt1 ├── iso_schematron_message_xslt1.xsl ├── ExtractSchFromRNG.xsl ├── readme.txt ├── ExtractSchFromXSD.xsl ├── iso_abstract_expand.xsl ├── iso_svrl_for_xslt1.xsl └── schematron-skeleton-api.htm ├── iso-schematron-xslt2 ├── iso_schematron_message_xslt2.xsl ├── ExtractSchFromRNG-2.xsl ├── readme.txt ├── ExtractSchFromXSD-2.xsl ├── sch-messages-en.xhtml ├── sch-messages-cs.xhtml ├── sch-messages-nl.xhtml ├── sch-messages-fr.xhtml ├── sch-messages-de.xhtml ├── iso_abstract_expand.xsl ├── iso_svrl_for_xslt2.xsl └── schematron-skeleton-api.htm ├── README.md └── xproc └── test-schematron.xpl /.gitignore: -------------------------------------------------------------------------------- 1 | properties.xml 2 | -------------------------------------------------------------------------------- /example/stf-errors/nogo/foo-2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # stf Examples 2 | 3 | The examples is this directory demonstrate both success and failure 4 | with stf tests. 5 | -------------------------------------------------------------------------------- /example/stf-errors/nogo/foo-1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /properties.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Local properties for 'stf' system. 4 | 6 | 7 | 12 | 13 | /E:/saxon/saxon9he.jar 14 | 15 | -------------------------------------------------------------------------------- /example/example.sch: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 16 | Number of 'foo' and 'bar' should be equal. 17 | 19 | baz should contain no more than 5 bar. 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /example/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Examples of running 'stf' with tests that fail and pass. 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 13 | 14 | 15 | 16 | 17 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Mentea 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | - Redistributions of source code must retain the above copyright 8 | notice, this list of conditions, and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions, and the following disclaimer in the 12 | documentation and/or other materials provided with the 13 | distribution. 14 | 15 | - Neither the name of Mentea nor the names of 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | This software is provided "AS IS," without a warranty of any 20 | kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS, AND 21 | WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE, OR NON INFRINGEMENT, ARE HEREBY 23 | EXCLUDED. MENTEA AND ITS LICENSORS SHALL NOT BE LIABLE 24 | FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, 25 | MODIFYING, OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO 26 | EVENT SHALL MENTEA OR ITS LICENSORS BE LIABLE FOR ANY 27 | LOST REVENUE, PROFIT, OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, 28 | CONSEQUENTIAL, INCIDENTAL, OR PUNITIVE DAMAGES, HOWEVER CAUSED AND 29 | REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF 30 | OR INABILITY TO USE THE SOFTWARE, EVEN IF MENTEA HAS 31 | BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 32 | -------------------------------------------------------------------------------- /stf.properties.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Properties for 'stf' system. 4 | 6 | 7 | 12 | 13 | 14 | 15 | /usr/local/Oxygen XML Editor 13 16 | 18 | 19 | ${oxygenInstallDir}/lib/xproc/calabash/calabash.jar 20 | 21 | ${oxygenInstallDir}/lib/saxon9ee.jar 22 | 23 | ${oxygenInstallDir}/lib/resolver.jar 24 | 25 | org.apache.xml.resolver.tools.CatalogResolver 26 | 27 | 28 | /usr/share/java/saxonb.jar 29 | /usr/share/java/saxon9.jar 30 | /E:/saxon/saxon9he.jar 31 | 32 | 33 | 34 | 35 | ${system.basedir.converted}/schematron/testing.sch 36 | 37 | 38 | xslt2 39 | 40 | 41 | ${stf.basedir.converted}/iso-schematron-${schematron.binding} 42 | 43 | -------------------------------------------------------------------------------- /iso-schematron-xslt1/iso_schematron_message_xslt1.xsl: -------------------------------------------------------------------------------- 1 | 2 | 25 | 26 | 27 | 28 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 44 | 45 | 46 | 47 | 48 | 49 | ( 51 | / 52 | ) 53 | 54 | 55 | -------------------------------------------------------------------------------- /iso-schematron-xslt2/iso_schematron_message_xslt2.xsl: -------------------------------------------------------------------------------- 1 | 2 | 25 | 26 | 27 | 28 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 44 | 45 | 46 | 47 | 48 | 49 | ( 51 | / 52 | ) 53 | 54 | 55 | -------------------------------------------------------------------------------- /iso-schematron-xslt1/ExtractSchFromRNG.xsl: -------------------------------------------------------------------------------- 1 | 2 | 8 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /iso-schematron-xslt2/ExtractSchFromRNG-2.xsl: -------------------------------------------------------------------------------- 1 | 2 | 8 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /iso-schematron-xslt2/readme.txt: -------------------------------------------------------------------------------- 1 |

ISO SCHEMATRON 2010

2 | 3 | XSLT implementation by Rick Jelliffe with assistance from members of Schematron-love-in maillist. 4 | 5 | 2010-04-14 6 | 7 | Two distributions are available. One is for XSLT1 engines. 8 | The other is for XSLT2 engines, such as SAXON 9. 9 | 10 | 11 | This version of Schematron splits the process into a pipeline of several different XSLT stages. 12 | 13 | 1) First, preprocess your Schematron schema with iso_dsdl_include.xsl. 14 | This is a macro processor to assemble the schema from various parts. 15 | If your schema is not in separate parts, you can skip this stage. 16 | 17 | 2) Second, preprocess the output from stage 1 with iso_abstract_expand.xsl. 18 | This is a macro processor to convert abstract patterns to real patterns. 19 | If your schema does not use abstract patterns, you can skip this 20 | stage. 21 | 22 | 3) Third, compile the Schematron schema into an XSLT script. 23 | This will typically use iso_svrl_for_xslt1.xsl or iso_svrl_for_xslt2.xsl 24 | (which in turn invoke iso_schematron_skeleton_for_xslt1.xsl or iso_schematron_skeleton_for_saxon.xsl) 25 | However, other "meta-styleseets" are also in common use; the principle of operation is the same. 26 | If your schema uses Schematron phases, supply these as command line/invocation parameters 27 | to this process. 28 | 29 | 4) Fourth, run the script generated by stage 3 against the document being validated. 30 | If you are using the SVRL script, then the output of validation will be an XML document. 31 | If your schema uses Schematron parameters, supply these as command line/invocation parameters 32 | to this process. 33 | 34 | 35 | The XSLT2 distribution also features several next generation features, 36 | such as validating multiple documents. See the source code for details. 37 | 38 | Schematron assertions can be written in any language, of course; the file 39 | sch-messages-en.xhtml contains the diagnostics messages from the XSLT2 skeleton 40 | in English, and this can be used as template to localize the skeleton's 41 | error messages. Note that typically programming errors in Schematron are XPath 42 | errors, which requires localized messages from the XSLT engine. 43 | 44 | ANT 45 | --- 46 | To give an example of how to process a document, here is a sample ANT task. 47 | 48 | 49 | 50 | 51 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | EXTRACTION SCHEMATRON FROM XSD OR RELAX NG 86 | 87 | The following files allow extracting of embedded schematron patterns 88 | in XML Schemas or RELAX NG schemas. For details, see the at 89 | article http://www.topologi.com/resources/schtrn_xsd_paper.html 90 | 91 | The following files are provided: 92 | ExtractSchFromRNG.xsl Generate a Schematron schema from patterns 93 | embedded in a RELAX NG schema. The schema uses XSLT1. 94 | ExtractSchFromXSD.xsl Generate a Schematron schema from patterns 95 | embedded in a W3C XML Schemas schema. The schema uses XSLT1. 96 | 97 | ExtractSchFromRNG-2.xsl Generate a Schematron schema from patterns 98 | embedded in a RELAX NG schema. The schema uses XSLT2. 99 | ExtractSchFromXSD-2.xsl Generate a Schematron schema from patterns 100 | embedded in a W3C XML Schemas schema. The schema uses XSLT2. -------------------------------------------------------------------------------- /iso-schematron-xslt1/readme.txt: -------------------------------------------------------------------------------- 1 |

ISO SCHEMATRON 2010

2 | 3 | XSLT implementation by Rick Jelliffe with assistance from members of Schematron-love-in maillist. 4 | 5 | 2010-04-21 6 | 7 | Two distributions are available. One is for XSLT1 engines. 8 | The other is for XSLT2 engines, such as SAXON 9. 9 | 10 | 11 | This version of Schematron splits the process into a pipeline of several different XSLT stages. 12 | 13 | 1) First, preprocess your Schematron schema with iso_dsdl_include.xsl. 14 | This is a macro processor to assemble the schema from various parts. 15 | If your schema is not in separate parts, you can skip this stage. 16 | This stage also generates error messages for some common XPath syntax problems. 17 | 18 | 2) Second, preprocess the output from stage 1 with iso_abstract_expand.xsl. 19 | This is a macro processor to convert abstract patterns to real patterns. 20 | If your schema does not use abstract patterns, you can skip this 21 | stage. 22 | 23 | 3) Third, compile the Schematron schema into an XSLT script. 24 | This will typically use iso_svrl_for_xslt1.xsl or iso_svrl_for_xslt2.xsl 25 | (which in turn invoke iso_schematron_skeleton_for_xslt1.xsl or iso_schematron_skeleton_for_saxon.xsl) 26 | However, other "meta-styleseets" are also in common use; the principle of operation is the same. 27 | If your schema uses Schematron phases, supply these as command line/invocation parameters 28 | to this process. 29 | 30 | 4) Fourth, run the script generated by stage 3 against the document being validated. 31 | If you are using the SVRL script, then the output of validation will be an XML document. 32 | If your schema uses Schematron parameters, supply these as command line/invocation parameters 33 | to this process. 34 | 35 | 36 | The XSLT2 distribution also features several next generation features, 37 | such as validating multiple documents. See the source code for details. 38 | 39 | Schematron assertions can be written in any language, of course; the file 40 | sch-messages-en.xhtml contains the diagnostics messages from the XSLT2 skeleton 41 | in English, and this can be used as template to localize the skeleton's 42 | error messages. Note that typically programming errors in Schematron are XPath 43 | errors, which requires localized messages from the XSLT engine. 44 | 45 | ANT 46 | --- 47 | To give an example of how to process a document, here is a sample ANT task. 48 | 49 | 50 | 51 | 52 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | EXTRACTION SCHEMATRON FROM XSD OR RELAX NG 87 | 88 | The following files allow extracting of embedded schematron patterns 89 | in XML Schemas or RELAX NG schemas. For details, see the at 90 | article http://www.topologi.com/resources/schtrn_xsd_paper.html 91 | 92 | The following files are provided: 93 | ExtractSchFromRNG.xsl Generate a Schematron schema from patterns 94 | embedded in a RELAX NG schema. The schema uses XSLT1. 95 | ExtractSchFromXSD.xsl Generate a Schematron schema from patterns 96 | embedded in a W3C XML Schemas schema. The schema uses XSLT1. 97 | 98 | ExtractSchFromRNG-2.xsl Generate a Schematron schema from patterns 99 | embedded in a RELAX NG schema. The schema uses XSLT2. 100 | ExtractSchFromXSD-2.xsl Generate a Schematron schema from patterns 101 | embedded in a W3C XML Schemas schema. The schema uses XSLT2. -------------------------------------------------------------------------------- /iso-schematron-xslt1/ExtractSchFromXSD.xsl: -------------------------------------------------------------------------------- 1 | 2 | 8 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 40 | 41 | 42 | 43 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /iso-schematron-xslt2/ExtractSchFromXSD-2.xsl: -------------------------------------------------------------------------------- 1 | 2 | 8 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 40 | 41 | 42 | 43 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /iso-schematron-xslt2/sch-messages-en.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 8 | Schema error: Schematron elements in old and new namespaces found 9 | Schema error: in the queryBinding attribute, use 'xslt' 10 | Fail: This implementation of ISO Schematron does not work with schemas using the query language 11 | 12 | Phase Error: no phase has been defined with name 13 | 14 | Markup Error: no pattern attribute in <active> 15 | Reference Error: the pattern " 16 | " has been activated but is not declared 17 | Markup Error: no test attribute in <assert> 18 | Markup Error: no test attribute in <report> 19 | Markup Error: no id attribute in <diagnostic> 20 | Markup Error: no rule attribute in <extends> 21 | Reference Error: the abstract rule " 22 | " has been referenced but is not declared 23 | Markup Error: no name attribute in <key> 24 | Markup Error: no path or use attribute in <key> 25 | Markup Error: no path or use attribute in <key> 26 | Schema error: The <key> element is not in the ISO Schematron namespace. Use the XSLT namespace. 27 | Markup Error: no name attribute in <function> 28 | Schema error: The <function> element is not in the ISO Schematron namespace. Use the XSLT namespace. 29 | Schema error: Empty href attribute for <include> directive. 30 | Error: Impossible URL in Schematron <include> 31 | Error: Unable to open referenced included file: 32 | 33 | Schema error: Use <include> to include fragments, not a whole schema 34 | Schema error: XSD schemas may only be imported if you are using the 'xslt2' query language binding 35 | Schema error: The <import-schema> element is not available in the ISO Schematron namespace. Use the XSLT namespace. 36 | Warning: Variables should not be used with the "xpath" query language binding. 37 | Warning: Variables should not be used with the "xpath2" query language binding. 38 | Markup Error: no uri attribute in <ns> 39 | Markup Error: no prefix attribute in <ns> 40 | Schema implementation error: This schema has abstract patterns, yet they are supposed to be preprocessed out already 41 | Markup Error: no id attribute in <phase> 42 | Markup Error: no context attribute in <rule> 43 | Markup Error: no id attribute on abstract <rule> 44 | Markup Error: (2) context attribute on abstract <rule> 45 | Markup Error: context attribute on abstract <rule> 46 | Markup Error: no select attribute in <value-of> 47 | Warning: 48 | must not contain any child elements 49 | Reference error: A diagnostic " 50 | " has been referenced but is not declared 51 | Warning: Using the XSLT namespace with a prefix other than "xsl" in Schematron rules is not supported in this processor: 52 | 53 | Error: unrecognized element in ISO Schematron namespace: check spelling and capitalization 54 | 55 | Warning: unrecognized element 56 | 57 | -------------------------------------------------------------------------------- /iso-schematron-xslt2/sch-messages-cs.xhtml: -------------------------------------------------------------------------------- 1 | 3 | 6 | Chyba ve schématu: nalezeny elementy Schematronu ve starém i novém jmenném prostoru 7 | Chyba ve schématu: v atributu queryBinding použijte 'xslt' 8 | Porucha: Tato implementace ISO Schematronu nefunguje se schématy, která používají dotazovací jazyk 9 | 10 | Fázová chyba: fáze jménem 11 | není definována. 12 | Chybný markup: v elementu <active> chybí atribut pattern 13 | Chybný odkaz: vzor " 14 | " byl aktivován, ne však deklarován 15 | Chybný markup: v elementu <assert> chybí atribut test 16 | Chybný markup: v elementu <report> chybí atribut test 17 | Chybný markup: v elementu <diagnostic> chybí atribut id 18 | Chybný markup: v elementu <extends> chybí atribut rule 19 | Chybný odkaz: abstraktní pravidlo " 20 | " není definováno, ačkoli se na ně odkazuje 21 | Chybný markup: v elementu <key> chybí atribut name 22 | Chybný markup: v elementu <key> chybí atribut path nebo use 23 | Chybný markup: v elementu <key> chybí atribut path nebo use 24 | Chyba ve schématu: element <key> není ve jmenném prostoru ISO Schematronu. Použijte jmenný prostor XSLT. 25 | Chybný markup: v elementu <function> chybí atribut name 26 | Chyba ve schématu: element <function> není ve jmenném prostoru ISO Schematronu. Použijte jmenný prostor XSLT. 27 | Chyba ve schématu: direktiva <include> má prázdný atribut href 28 | Chyba: Nesprávné URL v direktivě <include> 29 | Chyba: Nelze otevřít vkládaný soubor 30 | 31 | Chyba ve schématu: <include> používejte ke vkládání fragmentů, ne celého schématu 32 | Chyba ve schématu: Schémata XSD lze importovat pouze pokud používáte dotazovací jazyk "xslt2" 33 | Chyba ve schématu: element <import-schema> není ve jmenném prostoru ISO Schematronu. Použijte jmenný prostor XSLT. 34 | Varování: S dotazovacím jazykem "xpath" by se neměly používat proměnné 35 | Varování: S dotazovacím jazykem "xpath2" by se neměly používat proměnné 36 | Chybný markup: v elementu <ns> chybí atribut uri 37 | Chybný markup: v elementu <ns> chybí atribut prefix 38 | Chyba v implementaci schématu: toto schéma obsahuje abstraktní vzory, které však již měly být předchozím zpracováním odstraněny 39 | Chybný markup: v elementu <phase> chybí atribut id 40 | Chybný markup: v elementu <rule> chybí atribut context 41 | Chybný markup: v abstraktním pravidlu chybí atribut id 42 | Chybný markup: (2) Abstraktní pravidlo nesmí mít atribut context 43 | Chybný markup: Abstraktní pravidlo nesmí mít atribut context 44 | Chybný markup: v elementu <value-of> chybí atribut select 45 | Varování: 46 | nesmí obsahovat žádné podelementy 47 | Chybný odkaz: Diagnostika " 48 | " nebyla deklarována, ačkoli se na ni odkazuje 49 | Chyba: procesor 50 | nepodporuje použití jmenného prostoru XSLT s jiným prefixem než "xsl" 51 | Chyba: neznámý element 52 | ve jmenném prostoru ISO Schematronu: zkontrolujte, je-li správně zapsán 53 | Varování: neznámý element 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /iso-schematron-xslt2/sch-messages-nl.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 6 | Schema fout: er werden Schematron elementen uit de oude en nieuwe 7 | namespace gevonden 8 | Schema fout: gebruik 'xslt' in het queryBinding attribute 9 | Faling: Deze implementatie van ISO Schematron werkt niet met 10 | schemas die gebruik maken van de query language 11 | 12 | Fase fout: er is geen 'phase' gedefinieerd met naam 13 | 14 | Markup fout: er is geen 'pattern' attribuut in <active> 15 | Referentie fout: het 'pattern' " 16 | " is geactiveerd maar niet gedeclareerd 17 | Markup fout: er is geen 'test' attribuut in <assert 18 | Markup fout: er is geen 'test' attribuut in <report> 19 | Markup fout: er is geen 'id' attribuut in <diagnostic> 20 | Markup fout: er is geen 'rule' attribuut in <extends> 21 | Referentie fout: de abstracte regel " 22 | " werd gerefereerd maar niet gedeclareerd 23 | Markup fout: er is geen 'name' attribuut in <key> 24 | Markup fout: er is geen 'path' of 'use' attribuut in <key> 25 | Markup fout: er is geen 'path' of 'use' attribuut in <key> 26 | Schema fout: Het 'key' element zit niet in de ISO Schematron namespace. Gebruik de XSLT namespace. 27 | Markup fout: er is geen 'name' attribuut in <function> 28 | Schema fout: Het 'function' element zit niet in de ISO Schematron namespace. Gebruik de XSLT namespace. 29 | Schema fout: Leeg 'href=' attribuut bij de include opdracht. 30 | Fout: Onmogelijke URL gebruikt bij de Schematron include 31 | Kan de gerefereerde 'include' file niet openen: 32 | 33 | Schema fout: Gebruik include om fragmenten op te nemen, niet een volledig schema 34 | Schema fout: XSD schemas kunnen enkel geïmporteerd worden indien de 'xslt2' query language binding gebruikt is 35 | Schema fout: Het 'import-schema' element is niet beschikbaar in the ISO Schematron namespace. Gebruik de XSLT namespace. 36 | Waarschuwing: Variabelen niet gebruiken met de "xpath" query language binding. 37 | Waarschuwing: Variabelen niet gebruiken met de "xpath2" query language binding. 38 | Markup fout: er is geen 'uri' attribute in <ns> 39 | Markup fout: er is geen 'prefix' attribute in <ns> 40 | Schema implementatie fout: Dit schema heeft abstracte patronen, die al gepreprocessed zouden moeten zijn 41 | Markup fout: er is geen 'id' attribuut in <phase> 42 | Markup fout: er is geen 'context' attribuut in <rule> 43 | Markup fout: er is geen 'id' attribuut op abstracte <rule> 44 | Markup fout: (2) context attributen op abstracte <rule> 45 | Markup fout: context attribuut op abstracte <rule> 46 | Markup fout: er is geen 'select' attribute in <value-of> 47 | Waarschuwing: 48 | mag geen kind elementen bevatten 49 | Referentie fout: Een diagnostic " 50 | " werd gerefereerd maar is niet gedeclareerd. 51 | Het gebruik van de XSLT namespace met een prefix verschillend 52 | van "xsl" in Schematron regels wordt niet ondersteund in deze processor: 53 | 54 | Fout: een niet herkend element in de ISO Schematron namespace: check spelling en hoofdlettergebruik 55 | 56 | Waarschuwing: een niet herkend element 57 | 58 | 59 | -------------------------------------------------------------------------------- /iso-schematron-xslt2/sch-messages-fr.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 6 | Erreur de schema: éléments Schematron à la fois dans l'ancien et le nouveau namespace 7 | Erreur de schema: utilisez 'xslt' dans l'attribut queryBinding 8 | Échec: Cette implémentation de Schematron ISO ne fonctionne pas avec des schemas utilisant le langage de query 9 | 10 | Erreur de phase: aucune phase n'a été définie avec le nom 11 | 12 | Erreur de balisage: pas d'attribut pattern dans <active> 13 | Erreur de référence: le pattern " 14 | " a été activé mais n'a pas été décalaré 15 | Erreur de balisage: pas d'attribut test dans <assert> 16 | Erreur de balisage: pas d'attribut test dans <report> 17 | Erreur de balisage: pas d'attribut id dans <diagnostic> 18 | Erreur de balisage: pas d'attribut rule dans <extends> 19 | Erreur de référence: la règle abstraite " 20 | " a été référencée mais pas déclarée 21 | Erreur de balisage: pas d'attribut name dans <key> 22 | Erreur de balisage: pas d'attribut path ou use dans <key> 23 | Erreur de schema: L'élément key n'est pas dans le namespace Schematron ISO. Utilisez le namespace XSLT. 24 | Erreur de balisage: pas d'attribut name dans <function> 25 | Erreur de schema: L'élément function n'est pas dans le namespace Schematron ISO. Utilisez le namespace XSLT. 26 | Erreur de schema: Attribut href vide sur a directive include. 27 | Erreur: URL impossible dans la directive include de Schematron 28 | Impossible d'ouvrir le fichier référencé pour l'inclusion: 29 | 30 | Erreur de schema: Utilisez include pour inclure des fragments et non un schema entier 31 | Erreur de schema: Les schema XSD peuvent être importés seulement si vous utilisez the langage de query 'xslt2' 32 | Erreur de schema: L'élément import-schema n'est pas disponible dans le namespace Schematron ISO. Utilisez le namespace XSLT. 33 | Avertissement: Des variables ne devraient pas être utiliées avec le langage de query "xpath". 34 | Avertissement: Des variables ne devraient pas être utiliées avec le langage de query "xpath2". 35 | Erreur de balisage: pas d'attribut uri dans <ns> 36 | Erreur de balisage: pas d'attribut prefix dans <ns> 37 | 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 38 | Erreur de balisage: pas d'attribut id dans <phase> 39 | Erreur de balisage: pas d'attribut context dans <rule> 40 | Erreur de balisage: pas d'attribut id dans <rule> 41 | Erreur de balisage: (2) attribut context dans une <rule> abstraite 42 | Erreur de balisage: attribut context dans une <rule> abstraite 43 | Erreur de balisage: pas d'attribut select dans <value-of> 44 | Avertissement: 45 | ne peut contenir aucun élément enfant 46 | Erreur de référence: Un diagnostique " 47 | " a été référencé mais n'est pas déclaré 48 | Utiliser the namespace XSLT avec un autre préfixe que "xsl" dans les rules Schematron n'est pas supporté par ce processor: 49 | 50 | Erreur: élément inconnu dans le namespace Schematron ISO: vérifiez l'orthographe et la casse 51 | 52 | Avertissement: élément inconnu 53 | 54 | 55 | -------------------------------------------------------------------------------- /iso-schematron-xslt2/sch-messages-de.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 8 | Fehler im Schema: Schematron Elemente sowohl im alten als auch neuen Namensraum gefunden 9 | Fehler im Schema: Nutzen Sie 'xslt' im queryBinding-Attribut 10 | Fehler: Diese Implementierung von ISO Schematron arbeitet nicht mit Schemas zusammen, die die Query Language 11 | nutzen 12 | Phasenfehler: Es gibt keine Phase mit Namen 13 | 14 | Fehler in der Annotation: Kein Attribut pattern in <active> 15 | Referenzierungsfehler: Der Ausdruck " 16 | " wurde aktiviert, ist aber nicht deklariert 17 | Fehler in der Annotation: Kein Attribut test in <assert 18 | Fehler in der Annotation: Kein Attribut test <report> 19 | Fehler in der Annotation: Kein Attribut id in <diagnostic> 20 | Fehler in der Annotation: Kein Attribut rule in <extends> 21 | Referenzierungsfehler: Die abstrakte Regel " 22 | " wurde referenziert, ist aber nicht deklariert 23 | Fehler in der Annotation: Kein Attribut name in <key> 24 | Fehler in der Annotation: Kein Attribut path oder use in <key> 25 | Fehler in der Annotation: Kein Attribut path oder use in <key> 26 | Fehler im Schema: Das Element key ist im ISO Schematron-Namensraum nicht vorhanden. Benutzen Sie den XSLT-Namensraum. 27 | Fehler in der Annotation: Kein Attribut name in <function> 28 | Fehler im Schema: Das Element function ist im ISO Schematron-Namensraum nicht vorhanden. Benutzen Sie den XSLT-Namensraum. 29 | Fehler im Schema: Leeres Attribut href= für include Anweisung. 30 | Fehler: Ungültige URL in Schematron include 31 | Kann die referenzierte Datei nicht öffnen: 32 | 33 | Fehler im Schema: include darf nur zur Einbettung von Schemafragmenten genutzt werden, nicht für ganze Schemata 34 | Fehler im Schema: XSD Schemata dürfen nur importiert werden, wenn das 'xslt2' Query Language Binding genutzt wird 35 | Fehler im Schema: Das Element import-schema ist im ISO Schematron-Namensraum nicht vorhanden. Benutzen Sie den XSLT-Namensraum. 36 | Warnung: Variablen sollten nicht zusammen mit dem "xpath" Query Language Binding genutzt werden. 37 | Warnung: Variablen sollten nicht zusammen mit dem "xpath2" Query Language Binding genutzt werden. 38 | Fehler in der Annotation: Fehlendes Attiribut uri in <ns> 39 | Fehler in der Annotation: Fehlendes Attribut prefix in <ns> 40 | Fehler bei der Schemaimplementierung: Dieses Schema enthält abstrakte Mustervergleiche, die bereits vorverarbeitet sein sollten. 41 | Fehler in der Annotation: Fehlendes Attiribut id in <phase> 42 | Fehler in der Annotation: Fehlendes Attiribut context in <rule> 43 | Fehler in der Annotation: Fehlendes Attiribut id on abstract <rule> 44 | Fehler in der Annotation: (2) context attribute on abstract <rule> 45 | Fehler in der Annotation: Attribut context bei abstrakter <rule> 46 | Fehler in der Annotation: Fehlendes Attiribut select in <value-of> 47 | Warnung: 48 | darf keine Kindelemente beinhalten 49 | Referenzierungsfehler: Ein diagnostic-Element " 50 | " wurde referenziert, ist aber nicht deklariert 51 | Der Gebrauch des XSLT-Namensraums mit einem anderen Präfix als "xsl" in Schematron-Regeln wird von diesem Prozessor nicht unterstützt: 52 | 53 | Fehler: Unbekanntes Element im ISO Schematron-Namensraum: Überprüfen Sie die Schreibweise (inkl. Groß- und Kleinschreibung) 54 | 55 | Warnung: Unbekanntes Element 56 | 57 | 58 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | * Version: 0.1 2 | * Author: Mentea 3 | * Date: 24 November 2011 4 | 5 | # Schematron Testing Framework (`stf`) 6 | 7 | Schematron (http://www.schematron.com/) is a language for making 8 | assertions about the presence or absence of patterns in XML documents. 9 | It is based not on grammars but on finding tree patterns in the parsed 10 | document. If you know XPath or the XSLT expression language, you can 11 | use Schematron. 12 | 13 | `stf` is a XProc pipeline that runs your Schematron on your test files and reports any unexpected results. 14 | 15 | ## Why use Schematron? 16 | 17 | Schematron allows you to develop and mix two kinds of schemas: 18 | 19 | * `assert` elements allow you to confirm that the document conforms to a particular schema. 20 | 21 | * `report` elements allow you to diagnose which variant of a language you are dealing with. 22 | 23 | An example Schematron `rule` with one `assert` and one `report`: 24 | 25 | 26 | 28 | Number of 'foo' and 'bar' should be equal. 29 | 31 | ‘baz’ should contain no more than 5 ‘bar’. 32 | 33 | 34 | 35 | ## Why Use `stf`? 36 | 37 | A suite of Schematron tests contains many contexts where a bug in a 38 | document will make a Schematron `assert` fail or a `report` succeed, so it 39 | follows that for any new test suite and any reasonably sized but buggy 40 | document set, there will straight away be many `assert` and `report` 41 | messages produced by the tests. When that happens, how can you be 42 | sure your Schematron tests all worked as expected? How can you 43 | separate the expected results from the unexpected? What’s needed is a 44 | way to characterise the Schematron tests before you start as reporting 45 | only what they should, no more, and no less. 46 | 47 | `stf` is a XProc pipeline that runs a Schematron test suite on test 48 | documents (that you create) and winnows out the expected results and 49 | report just the unexpected. `stf` uses a processing instruction (PI) in 50 | each of a set of (typically, small) test documents to indicate the 51 | test’s expected `assert`s and `report`s: the expected results are ignored, 52 | and all you see is what’s extra or missing. And when you have no more 53 | unexpected results from your test documents, you’re ready to use the 54 | Schematron on your real documents. 55 | 56 | `stf` was created by Mentea (http://www.mentea.net). It is Open Source 57 | and under a BSD license. You are welcome to use it, to contribute to 58 | the project, or to fork it in accordance with the terms of the 59 | license. 60 | 61 | ## Prerequisites 62 | 63 | Requires Ant and Calabash. Calabash (as used here) requires Saxon. All three require Java. 64 | 65 | ## `` Processing Instruction 66 | 67 | The format of the PI is: 68 | 69 | 70 | 71 | where: 72 | 73 | * `stf` 74 | 75 | PI target 76 | 77 | * `#NONE` 78 | 79 | No failed `assert` or successful `report` expected. Use with 80 | '`go`' tests that should not have any `assert` 81 | or `report` messages. If running Schematron on the test 82 | produces any `assert`s or `report`s, they are 83 | reported as an error. 84 | 85 | * _ROLE_ 86 | 87 | Token corresponding to `@role` value of an 88 | `assert` or a `report` in the Schematron. 89 | Schematron allows `@role` to be an arbitrary 90 | string, but restricting it to a single token 91 | makes it easier to deal with the PI using 92 | regular expressions rather than having to 93 | parse roles that may contain spaces. 94 | 95 | * _COUNT_ 96 | 97 | Integer number of expected occurrences of 98 | failed `assert`s or successful `report`s with 99 | `@role` value matching _ROLE_. 100 | 101 | A mismatch between the expected and actual 102 | count is reported as an error. 103 | 104 | A _ROLE_ starting with `#` does not have its 105 | count checked. 106 | 107 | * _\s_ 108 | 109 | Whitespace character 110 | 111 | ## Examples 112 | 113 | Some sample test documents (that may be used with the Schematron 114 | rule shown above) are shown below, along with explanations of the ex- 115 | pectations expressed by their `` processing instructions. The 116 | documents, the schema expressed by the Schematron, and the expected 117 | Schematron results are deliberately mismatched for the sake of providing 118 | the example `stf` output below. 119 | 120 | 121 | 122 | 123 | 124 | 125 | A failed `assert` or successful `report` with `role="ERROR_BAR"` 126 | is expected once in the SVRL from the test document, and 127 | either with `role="ERROR_QUX"` is expected once, and no 128 | `assert` or `report` with `role="ERROR_LATER"` is expected, 129 | since `#` precedes `ERROR_LATER`. 130 | 131 | 132 | 133 | 134 | 135 | 136 | No `assert` or `report` are expected for the current document. 137 | 138 | ## Running `stf` 139 | 140 | 1. Set the properties in `properties.xml` to match your local setup. 141 | 142 | 2. Write the tests, including a `` processing instruction in each. 143 | 144 | One practice is to use a '`tests`' directory containing a '`go`' 145 | subdirectory for tests that are expected to have no Schematron 146 | `assert` or `report` errors and a '`nogo`' subdirectory for tests 147 | that are expected to have errors, but you can organise them any 148 | way you like. 149 | 150 | 3. Use Ant to run `${schematron}` on files in `${test.dir}`. 151 | 152 | You can run the `test.schematron` from `build.xml` directly: 153 | 154 | ant -f /path/to/stf/build.xml test.schemtron 155 | 156 | or you can import the `stf` "`build.xml`" into your local "`build.xml`": 157 | 158 | 159 | 160 | 161 | and run the `test.schematron` target, or you can import the `stf` 162 | `build.xml` and use the `` macro in your local 163 | `build.xml` (maybe along with your other tests): 164 | 165 | 166 | 167 | 168 | 169 | 170 | ## Example Output 171 | 172 | The `stf` output for running the Schematron on the two deliberately mis- 173 | matched test documents shown above is shown below. Note that run- 174 | ning the Schematron on the first file above produces a `report` for 175 | `ERROR_BAR`, but since that report is expected, `stf` does not report it as 176 | an error. 177 | 178 | 179 | 180 | file:foo-1.xml 181 | Should be 1 reports or asserts for ERROR_QUX. 182 | Found 0. 183 | Unexpected: ERROR_FOO:1 184 | 185 | 186 | file:foo-2.xml 187 | Should be no reports or asserts. 188 | Unexpected: ERROR_FOO:1 189 | 190 | 191 | 192 | When the Schematron, the test documents, 193 | and their expected Schematron results are 194 | aligned, the `stf` output is: 195 | 196 | 197 | 198 | 199 | ## Ant Properties 200 | 201 | * `${schematron}` 202 | 203 | Schematron file to test. 204 | 205 | * `${tests.dir}` 206 | 207 | Directory containing test files. 208 | 209 | * `${calabash.jar}` 210 | 211 | Location of Calabash jar. 212 | 213 | * `${saxon.jar}` 214 | 215 | Location of Saxon 9.2 (or later) jar. 216 | 217 | * `${resolver.jar}` 218 | 219 | Location of XML catalog resolver library. 220 | 221 | * `${resolver.class}` 222 | 223 | Class name of XML catalog resolver. Default is 224 | `org.apache.xml.resolver.tools.CatalogResolver`. 225 | 226 | 227 | ## XProc Processor 228 | 229 | The pipeline currently depends on Calabash extensions. 230 | 231 | The version of Calabash used in testing depended on Saxon 9.2 or later. 232 | 233 | ## Running (Not Testing) Schematron 234 | 235 | Ant build file also includes `schematron` macro and `run.schematron` 236 | target to make it easy to run Schematron on real files once you're 237 | sure it works on your tests. 238 | 239 | ## License 240 | 241 | Licensed under the terms of a BSD license. See the file `COPYING` for 242 | details. 243 | 244 | -------------------------------------------------------------------------------- /iso-schematron-xslt1/iso_abstract_expand.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 20 | 43 | 66 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 112 | 113 | 114 | 130 | 131 | 132 | 133 | Suppressed abstract pattern was here 134 | 135 | 136 | 137 | 138 | 139 | 140 | Start pattern based on abstract 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 192 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | -------------------------------------------------------------------------------- /iso-schematron-xslt2/iso_abstract_expand.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 20 | 43 | 66 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 112 | 113 | 114 | 130 | 131 | 132 | 133 | Suppressed abstract pattern was here 134 | 135 | 136 | 137 | 138 | 139 | 140 | Start pattern based on abstract 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 192 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | -------------------------------------------------------------------------------- /xproc/test-schematron.xpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 37 | 38 | 39 | 40 | 41 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 151 | 152 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 168 | 173 | 174 | 177 | 178 | 180 | 183 | 184 | 185 | 186 | 189 | 192 | 193 | 196 | 197 | 200 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 229 | 230 | 231 | 232 | 233 | 237 | 238 | 240 | 241 | 242 | 243 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 255 | 258 | 259 | 261 | 263 | No 'stf' processing instruction. 264 | 265 | 267 | 268 | Should be no reports or asserts. 269 | 271 | Unexpected: 272 | 274 | : 275 | 277 | 278 | 279 | 280 | 281 | 282 | 284 | 287 | 293 | 296 | 297 | Should be 298 | 300 | reports or asserts for 301 | 303 | . Found 304 | 306 | . 307 | 308 | 309 | 310 | 314 | 316 | 317 | Unexpected: 318 | 320 | : 321 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | -------------------------------------------------------------------------------- /iso-schematron-xslt1/iso_svrl_for_xslt1.xsl: -------------------------------------------------------------------------------- 1 | 2 | 93 | 116 | 117 | 118 | 119 | 130 | 131 | 140 | 141 | 145 | 148 | 149 | 150 | 155 | 156 | true 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | #ALL 168 | 169 | 170 | false 171 | true 172 | true 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | xslt1 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 |   235 |   236 |   237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | TERMINATING 305 | 306 | 307 | TERMINATING 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | TERMINATING 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 601 | 602 | 603 | 604 | 605 | 606 | -------------------------------------------------------------------------------- /iso-schematron-xslt2/iso_svrl_for_xslt2.xsl: -------------------------------------------------------------------------------- 1 | 2 | 102 | 125 | 126 | 127 | 128 | 140 | 141 | 151 | 152 | 155 | 156 | 157 | 164 | 165 | true 166 | true 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | #ALL 178 | 179 | 180 | false 181 | true 182 | true 183 | 184 | 185 | 186 | 187 | false 188 | 189 | 190 | default 191 | 192 | 193 | 194 | 195 | 1 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | xslt1 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 234 | 235 | 236 | 237 | 238 | 239 |   240 |   241 |   242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | TERMINATING 320 | 321 | 322 | TERMINATING 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | TERMINATING 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | -------------------------------------------------------------------------------- /iso-schematron-xslt1/schematron-skeleton-api.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | The ISO Schematron Skeleton API 6 | 7 | 8 | 9 | 10 | 11 |

API for ISO Schematron Skeleton

12 |



13 |

14 |

Rick Jelliffe, 2010/04/14

15 |

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

21 |

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

33 |

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

39 |

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

43 |

Superset of API for Schematron 1.5 and 1.6

44 |

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

48 |

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

55 |

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

57 |
58 |

process-prolog

59 |

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

62 |
63 |

process-root

64 |

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

67 |
68 |
node-list $contents 69 |
70 | string $schemaVersion 71 |
72 | The version of the schema, perhaps a datestamp. 73 |
74 | "xslt" | "xpath" | 75 | "xslt2" | ... 76 | $queryBinding 77 |
78 | The query language binding. 79 |
80 | string $title 81 |
82 | The title of this schema 83 |
84 | "iso" | "1.5" | 85 | "1.6" | ... 86 | $version 87 |
88 | The version of Schematron being used. 89 |
90 |

91 | Rich properties:

92 |
93 |
XML SystemId 94 | $icon 95 |
96 | The URI of an icon 97 |
98 | XML ID 99 | $id 100 |
101 | The unique identifier with the schema for the 102 | schema 103 | element. 104 |
105 | SGML FPI 106 | $fpi 107 |
108 | The Formal Public Identifier for this schema. 109 |
110 | IETF language 111 | $lang 112 |
113 | The human language used in this schema, from 114 | xml:lang 115 |
116 | URL 117 | $see 118 |
119 | Link to documentation on WWW or file 120 |
121 | "preserve" | "default" 122 | $space 123 |
124 | The value for xml:space 125 |
126 |

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

129 |

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

131 |
132 |

process-assert

133 |

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

136 |
137 |
XPath $test 138 |
139 | The test 140 |
141 | XML IDREFS $diagnostics 142 |
143 | A list of the idrefs diagnostic elements related to the current 144 | assertion 145 |
146 | XML NMTOKEN 147 | $flag 148 |
149 | The name of a flag that becomes true because 150 | this assertion fails. The flag is true for the document if it is 151 | flagged true on any assertion. For compatability, this parameter 152 | should not be used with Schematron 1.5. 153 |
154 |

155 | Rich properties:

156 |
157 |
XML SystemId 158 | $icon 159 |
160 | The URI of an icon 161 |
162 | XML ID 163 | $id 164 |
165 | The unique identifier with the schema for the 166 | assert 167 | element. 168 |
169 | SGML FPI 170 | $fpi 171 |
172 | The Formal Public Identifier for this 173 | assertion. 174 |
175 | IETF language 176 | $lang 177 |
178 | The human language used in this assertion, 179 | from xml:lang 180 |
181 | URL 182 | $see 183 |
184 | Link to documentation on WWW or file 185 |
186 | "preserve" | "default" 187 | $space 188 |
189 | The value for xml:space 190 |
191 |

192 | Linking properties:

193 |
194 |
XML NMTOKEN 195 | $role 196 |
197 | A name for the generic role of this assertion. 198 | The schema creator would have their own vocabulary. 199 |
200 | XPath 201 | $subject 202 |
203 | A path relative to the current context to some 204 | interesting node considered the subject. 205 |
206 |

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

209 |
210 |

process-diagnostic

211 |

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

215 |

Rich properties:

216 |
217 |
XML SystemId 218 | $icon 219 |
220 | The URI of an icon 221 |
222 | XML ID 223 | $id 224 |
225 | The unique identifier with the schema for the 226 | assert 227 | element. 228 |
229 | SGML FPI 230 | $fpi 231 |
232 | The Formal Public Identifier for this 233 | assertion. 234 |
235 | IETF language 236 | $lang 237 |
238 | The human language used in this assertion, 239 | from xml:lang 240 |
241 | URL 242 | $see 243 |
244 | Link to documentation on WWW or file 245 |
246 | "preserve" | "default" 247 | $space 248 |
249 | The value for xml:space 250 |

251 |
252 |

process-dir

253 |

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

255 |
256 |
"ltr" or "rtl" or "" 257 | $value 258 |
259 | Left-to-right or right-to-left or unspecified 260 |

261 |
262 |

process-emph

263 |

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

266 |
267 |

process-message

268 |

The process-message handles default outputing of text.

269 |
270 |
string $pattern 271 |
272 | Some text that may be some kind of pattern 273 |
274 | string $role 275 |
276 | Some text that may be some kind of role 277 |

278 |
279 |

process-name

280 |

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

286 |
287 |
string $name 288 |
289 | The name of the current element, or of the node specified by a name 290 | element 291 |

292 |
293 |

process-ns

294 |

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

297 |
298 |
Namespace NCName $prefix 299 |
300 | The prefix of a namespace 301 |
302 | XML SystemId $uri 303 |
304 | The (internationalized) URI Reference of a namespace 305 |

306 |
307 |

process-p

308 |

The process-p template handles paragraphs.

309 |
310 |
XML NMTOKEN $class 311 |
312 | An attribute that can be used for stylesheet style 313 |
314 | XML ID $id 315 |
316 | The unique identifier with the schema for the p element. 317 |
318 | XML SystemId $icon 319 |
320 | The URI of an icon 321 |
322 | IETF Language $lang 323 |
324 | The human language used in this paragraph 325 |
326 |

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

330 |
331 |

process-pattern

332 |

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

334 |
335 |
string $name 336 |
337 | The title of the current pattern 338 |
339 | XML NCNAMES $is-a 340 |
341 | Empty or not provided if the pattern is not derived from an abstract 342 | pattern. Otherwise the name of the abstract pattern. A list may be 343 | used if there was a sequence of abstract patterns. 344 |
345 |

346 | Rich properties:

347 |
348 |
XML SystemId 349 | $icon 350 |
351 | The URI of an icon 352 |
353 | XML ID 354 | $id 355 |
356 | The unique identifier with the schema for the 357 | pattern 358 | element. 359 |
360 | SGML FPI 361 | $fpi 362 |
363 | The Formal Public Identifier for this pattern. 364 | 365 |
366 | IETF language 367 | $lang 368 |
369 | The human language used in this pattern, from 370 | xml:lang 371 |
372 | URL 373 | $see 374 |
375 | A (internationalized) URI reference to some 376 | supporting or defining documentation 377 |
378 | "preserve" | "default" 379 | $space 380 |
381 | The value for xml:space 382 |
383 |

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

386 |
387 |

process-report

388 |

The process-report template handles report whose 389 | test has succeeded. 390 |

391 |
392 |
XPath $test 393 |
394 | The test 395 |
396 | XML IDREFS $diagnostics 397 |
398 | A list of the diagnostic elements related to the current assertion 399 |
400 | XML NMTOKEN 401 | $flag 402 |
403 | The name of a flag that becomes true because 404 | this assertion fails. The flag is true for the document if it is 405 | flagged true on any assertion. For compatability, this parameter 406 | should not be used with Schematron 1.5. 407 |
408 |

409 | Rich properties:

410 |
411 |
XML SystemId 412 | $icon 413 |
414 | The URI of an icon 415 |
416 | XML ID 417 | $id 418 |
419 | The unique identifier with the schema for the 420 | report 421 | element. 422 |
423 | SGML FPI 424 | $fpi 425 |
426 | The Formal Public Identifier for this report. 427 |
428 | IETF language 429 | $lang 430 |
431 | The human language used in this report, from 432 | xml:lang 433 |
434 | URL 435 | $see 436 |
437 | Link to documentation on WWW or file 438 |
439 | "preserve" | "default" 440 | $space 441 |
442 | The value for xml:space 443 |
444 |

445 | Linking properties:

446 |
447 |
XML NMTOKEN 448 | $role 449 |
450 | A name for the generic role of this assertion. 451 | The schema creator would have their own vocabulary. 452 |
453 | XPath 454 | $subject 455 |
456 | A path relative to the current context to some 457 | interesting node considered the subject. 458 |
459 |

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

462 |
463 |

process-rule

464 |

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

466 |
467 |
XSLT expression $context 468 |
469 | The expression that gives the context of the current 470 |
471 |

472 | Rich properties:

473 |
474 |
XML SystemId 475 | $icon 476 |
477 | The URI of an icon 478 |
479 | XML ID 480 | $id 481 |
482 | The unique identifier with the schema for this 483 | rule 484 | element. 485 |
486 | SGML FPI 487 | $fpi 488 |
489 | The Formal Public Identifier for this rule. 490 |
491 | IETF language 492 | $lang 493 |
494 | The human language used in this rule, from 495 | xml:lang 496 |
497 | URL 498 | $see 499 |
500 | Link to documentation on WWW or file 501 |
502 | "preserve" | "default" 503 | $space 504 |
505 | The value for xml:space 506 |
507 |

508 | Linking properties:

509 |
510 |
XML NMTOKEN 511 | $role 512 |
513 | A name for the generic role of this assertion. 514 | The schema creator would have their own vocabulary. 515 |
516 | XPath 517 | $subject 518 |
519 | A path relative to the current context to some 520 | interesting node considered the subject. 521 |

522 |
523 |

process-span

524 |

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

526 |
527 |
XML NMTOKEN $class 528 |
529 | An attribute that can be used for stylesheet style 530 |

531 |
532 |

process-title

533 |

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

535 |
536 |
XML NMTOKEN $class 537 |
538 | An attribute that can be used for stylesheet style 539 |
540 |

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

543 |
544 |

process-value-of

545 |

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

548 |
549 |
XPath $select 550 |
551 | The path of some node that will be evaluated and printed.

552 |
553 |

Global Parameters

554 |

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

559 |



560 |

561 | 562 | 563 | 564 | 565 | 566 | 569 | 572 | 575 | 576 | 577 | 580 | 584 | 590 | 591 | 592 | 595 | 598 | 603 | 604 | 605 | 608 | 611 | 616 | 617 | 618 | 621 | 624 | 629 | 630 | 631 | 634 | 637 | 642 | 643 | 644 | 648 | 651 | 655 | 656 | 657 | 660 | 664 | 667 | 668 | 669 | 672 | 676 | 679 | 680 | 681 | 684 | 688 | 692 | 693 | 694 | 698 | 702 | 705 | 706 | 707 | 710 | 713 | 717 | 718 |
567 |

Parameter

568 |
570 |

Value

571 |
573 |

Description

574 |
578 |

allow-foreign

579 |
581 |

"true" | "false" (default) 582 |

583 |
585 |

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

589 |
593 |

fileNameParameter

594 |
596 |

string

597 |
599 |

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

602 |
606 |

fileDirParameter

607 |
609 |

string

610 |
612 |

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

615 |
619 |

archiveNamePaameter

620 |
622 |

string

623 |
625 |

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

628 |
632 |

archiveDirParameter

633 |
635 |

string

636 |
638 |

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

641 |
645 |

debug 646 |

647 |
649 |

true” | “false” (default)

650 |
652 |

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

654 |
658 |

generate-paths

659 |
661 |

true|false 662 |

663 |
665 |

generate the SVRL @location attribute with XPaths

666 |
670 |

diagnose

671 |
673 |

yes | no 674 |

675 |
677 |

Add the diagnostics to the assertion results

678 |
682 |

terminate

683 |
685 |

yes | no | true | false | assert 686 |

687 |
689 |

Terminate on the first failed assertion or 690 | successful report

691 |
695 |

message-newline 696 |

697 |
699 |

"true" (default) | "false" 700 |

701 |
703 |

Generate an extra newline at the end of messages

704 |
708 |

output-encoding

709 |
711 |

string

712 |
714 |

The encoding used for output, for example if the 715 | output is XML

716 |
719 |
720 |
721 |
722 | 723 | -------------------------------------------------------------------------------- /iso-schematron-xslt2/schematron-skeleton-api.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | The ISO Schematron Skeleton API 6 | 7 | 8 | 9 | 10 | 11 |

API for ISO Schematron Skeleton

12 |



13 |

14 |

Rick Jelliffe, 2010/04/14

15 |

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

21 |

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

33 |

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

39 |

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

43 |

Superset of API for Schematron 1.5 and 1.6

44 |

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

48 |

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

55 |

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

57 |
58 |

process-prolog

59 |

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

62 |
63 |

process-root

64 |

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

67 |
68 |
node-list $contents 69 |
70 | string $schemaVersion 71 |
72 | The version of the schema, perhaps a datestamp. 73 |
74 | "xslt" | "xpath" | 75 | "xslt2" | ... 76 | $queryBinding 77 |
78 | The query language binding. 79 |
80 | string $title 81 |
82 | The title of this schema 83 |
84 | "iso" | "1.5" | 85 | "1.6" | ... 86 | $version 87 |
88 | The version of Schematron being used. 89 |
90 |

91 | Rich properties:

92 |
93 |
XML SystemId 94 | $icon 95 |
96 | The URI of an icon 97 |
98 | XML ID 99 | $id 100 |
101 | The unique identifier with the schema for the 102 | schema 103 | element. 104 |
105 | SGML FPI 106 | $fpi 107 |
108 | The Formal Public Identifier for this schema. 109 |
110 | IETF language 111 | $lang 112 |
113 | The human language used in this schema, from 114 | xml:lang 115 |
116 | URL 117 | $see 118 |
119 | Link to documentation on WWW or file 120 |
121 | "preserve" | "default" 122 | $space 123 |
124 | The value for xml:space 125 |
126 |

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

129 |

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

131 |
132 |

process-assert

133 |

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

136 |
137 |
XPath $test 138 |
139 | The test 140 |
141 | XML IDREFS $diagnostics 142 |
143 | A list of the idrefs diagnostic elements related to the current 144 | assertion 145 |
146 | XML NMTOKEN 147 | $flag 148 |
149 | The name of a flag that becomes true because 150 | this assertion fails. The flag is true for the document if it is 151 | flagged true on any assertion. For compatability, this parameter 152 | should not be used with Schematron 1.5. 153 |
154 |

155 | Rich properties:

156 |
157 |
XML SystemId 158 | $icon 159 |
160 | The URI of an icon 161 |
162 | XML ID 163 | $id 164 |
165 | The unique identifier with the schema for the 166 | assert 167 | element. 168 |
169 | SGML FPI 170 | $fpi 171 |
172 | The Formal Public Identifier for this 173 | assertion. 174 |
175 | IETF language 176 | $lang 177 |
178 | The human language used in this assertion, 179 | from xml:lang 180 |
181 | URL 182 | $see 183 |
184 | Link to documentation on WWW or file 185 |
186 | "preserve" | "default" 187 | $space 188 |
189 | The value for xml:space 190 |
191 |

192 | Linking properties:

193 |
194 |
XML NMTOKEN 195 | $role 196 |
197 | A name for the generic role of this assertion. 198 | The schema creator would have their own vocabulary. 199 |
200 | XPath 201 | $subject 202 |
203 | A path relative to the current context to some 204 | interesting node considered the subject. 205 |
206 |

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

209 |
210 |

process-diagnostic

211 |

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

215 |

Rich properties:

216 |
217 |
XML SystemId 218 | $icon 219 |
220 | The URI of an icon 221 |
222 | XML ID 223 | $id 224 |
225 | The unique identifier with the schema for the 226 | assert 227 | element. 228 |
229 | SGML FPI 230 | $fpi 231 |
232 | The Formal Public Identifier for this 233 | assertion. 234 |
235 | IETF language 236 | $lang 237 |
238 | The human language used in this assertion, 239 | from xml:lang 240 |
241 | URL 242 | $see 243 |
244 | Link to documentation on WWW or file 245 |
246 | "preserve" | "default" 247 | $space 248 |
249 | The value for xml:space 250 |

251 |
252 |

process-dir

253 |

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

255 |
256 |
"ltr" or "rtl" or "" 257 | $value 258 |
259 | Left-to-right or right-to-left or unspecified 260 |

261 |
262 |

process-emph

263 |

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

266 |
267 |

process-message

268 |

The process-message handles default outputing of text.

269 |
270 |
string $pattern 271 |
272 | Some text that may be some kind of pattern 273 |
274 | string $role 275 |
276 | Some text that may be some kind of role 277 |

278 |
279 |

process-name

280 |

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

286 |
287 |
string $name 288 |
289 | The name of the current element, or of the node specified by a name 290 | element 291 |

292 |
293 |

process-ns

294 |

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

297 |
298 |
Namespace NCName $prefix 299 |
300 | The prefix of a namespace 301 |
302 | XML SystemId $uri 303 |
304 | The (internationalized) URI Reference of a namespace 305 |

306 |
307 |

process-p

308 |

The process-p template handles paragraphs.

309 |
310 |
XML NMTOKEN $class 311 |
312 | An attribute that can be used for stylesheet style 313 |
314 | XML ID $id 315 |
316 | The unique identifier with the schema for the p element. 317 |
318 | XML SystemId $icon 319 |
320 | The URI of an icon 321 |
322 | IETF Language $lang 323 |
324 | The human language used in this paragraph 325 |
326 |

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

330 |
331 |

process-pattern

332 |

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

334 |
335 |
string $name 336 |
337 | The title of the current pattern 338 |
339 | XML NCNAMES $is-a 340 |
341 | Empty or not provided if the pattern is not derived from an abstract 342 | pattern. Otherwise the name of the abstract pattern. A list may be 343 | used if there was a sequence of abstract patterns. 344 |
345 |

346 | Rich properties:

347 |
348 |
XML SystemId 349 | $icon 350 |
351 | The URI of an icon 352 |
353 | XML ID 354 | $id 355 |
356 | The unique identifier with the schema for the 357 | pattern 358 | element. 359 |
360 | SGML FPI 361 | $fpi 362 |
363 | The Formal Public Identifier for this pattern. 364 | 365 |
366 | IETF language 367 | $lang 368 |
369 | The human language used in this pattern, from 370 | xml:lang 371 |
372 | URL 373 | $see 374 |
375 | A (internationalized) URI reference to some 376 | supporting or defining documentation 377 |
378 | "preserve" | "default" 379 | $space 380 |
381 | The value for xml:space 382 |
383 |

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

386 |
387 |

process-report

388 |

The process-report template handles report whose 389 | test has succeeded. 390 |

391 |
392 |
XPath $test 393 |
394 | The test 395 |
396 | XML IDREFS $diagnostics 397 |
398 | A list of the diagnostic elements related to the current assertion 399 |
400 | XML NMTOKEN 401 | $flag 402 |
403 | The name of a flag that becomes true because 404 | this assertion fails. The flag is true for the document if it is 405 | flagged true on any assertion. For compatability, this parameter 406 | should not be used with Schematron 1.5. 407 |
408 |

409 | Rich properties:

410 |
411 |
XML SystemId 412 | $icon 413 |
414 | The URI of an icon 415 |
416 | XML ID 417 | $id 418 |
419 | The unique identifier with the schema for the 420 | report 421 | element. 422 |
423 | SGML FPI 424 | $fpi 425 |
426 | The Formal Public Identifier for this report. 427 |
428 | IETF language 429 | $lang 430 |
431 | The human language used in this report, from 432 | xml:lang 433 |
434 | URL 435 | $see 436 |
437 | Link to documentation on WWW or file 438 |
439 | "preserve" | "default" 440 | $space 441 |
442 | The value for xml:space 443 |
444 |

445 | Linking properties:

446 |
447 |
XML NMTOKEN 448 | $role 449 |
450 | A name for the generic role of this assertion. 451 | The schema creator would have their own vocabulary. 452 |
453 | XPath 454 | $subject 455 |
456 | A path relative to the current context to some 457 | interesting node considered the subject. 458 |
459 |

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

462 |
463 |

process-rule

464 |

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

466 |
467 |
XSLT expression $context 468 |
469 | The expression that gives the context of the current 470 |
471 |

472 | Rich properties:

473 |
474 |
XML SystemId 475 | $icon 476 |
477 | The URI of an icon 478 |
479 | XML ID 480 | $id 481 |
482 | The unique identifier with the schema for this 483 | rule 484 | element. 485 |
486 | SGML FPI 487 | $fpi 488 |
489 | The Formal Public Identifier for this rule. 490 |
491 | IETF language 492 | $lang 493 |
494 | The human language used in this rule, from 495 | xml:lang 496 |
497 | URL 498 | $see 499 |
500 | Link to documentation on WWW or file 501 |
502 | "preserve" | "default" 503 | $space 504 |
505 | The value for xml:space 506 |
507 |

508 | Linking properties:

509 |
510 |
XML NMTOKEN 511 | $role 512 |
513 | A name for the generic role of this assertion. 514 | The schema creator would have their own vocabulary. 515 |
516 | XPath 517 | $subject 518 |
519 | A path relative to the current context to some 520 | interesting node considered the subject. 521 |

522 |
523 |

process-span

524 |

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

526 |
527 |
XML NMTOKEN $class 528 |
529 | An attribute that can be used for stylesheet style 530 |

531 |
532 |

process-title

533 |

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

535 |
536 |
XML NMTOKEN $class 537 |
538 | An attribute that can be used for stylesheet style 539 |
540 |

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

543 |
544 |

process-value-of

545 |

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

548 |
549 |
XPath $select 550 |
551 | The path of some node that will be evaluated and printed.

552 |
553 |

Global Parameters

554 |

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

559 |



560 |

561 | 562 | 563 | 564 | 565 | 566 | 569 | 572 | 575 | 576 | 577 | 580 | 584 | 590 | 591 | 592 | 595 | 598 | 603 | 604 | 605 | 608 | 611 | 616 | 617 | 618 | 621 | 624 | 629 | 630 | 631 | 634 | 637 | 642 | 643 | 644 | 648 | 651 | 655 | 656 | 657 | 660 | 664 | 667 | 668 | 669 | 672 | 676 | 679 | 680 | 681 | 684 | 688 | 692 | 693 | 694 | 698 | 702 | 705 | 706 | 707 | 710 | 713 | 717 | 718 |
567 |

Parameter

568 |
570 |

Value

571 |
573 |

Description

574 |
578 |

allow-foreign

579 |
581 |

"true" | "false" (default) 582 |

583 |
585 |

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

589 |
593 |

fileNameParameter

594 |
596 |

string

597 |
599 |

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

602 |
606 |

fileDirParameter

607 |
609 |

string

610 |
612 |

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

615 |
619 |

archiveNamePaameter

620 |
622 |

string

623 |
625 |

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

628 |
632 |

archiveDirParameter

633 |
635 |

string

636 |
638 |

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

641 |
645 |

debug 646 |

647 |
649 |

true” | “false” (default)

650 |
652 |

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

654 |
658 |

generate-paths

659 |
661 |

true|false 662 |

663 |
665 |

generate the SVRL @location attribute with XPaths

666 |
670 |

diagnose

671 |
673 |

yes | no 674 |

675 |
677 |

Add the diagnostics to the assertion results

678 |
682 |

terminate

683 |
685 |

yes | no | true | false | assert 686 |

687 |
689 |

Terminate on the first failed assertion or 690 | successful report

691 |
695 |

message-newline 696 |

697 |
699 |

"true" (default) | "false" 700 |

701 |
703 |

Generate an extra newline at the end of messages

704 |
708 |

output-encoding

709 |
711 |

string

712 |
714 |

The encoding used for output, for example if the 715 | output is XML

716 |
719 |
720 |
721 |
722 | 723 | --------------------------------------------------------------------------------