From ec94b609e7f5b2a578e52292c92b651540146951 Mon Sep 17 00:00:00 2001 From: Asger Askov Blekinge Date: Mon, 14 May 2012 15:58:26 +0200 Subject: [PATCH] code from the workflow --- .../schematron/ExtractSchFromRNG.xsl | 75 + .../schematron/ExtractSchFromXSD.xsl | 77 + profileValidator/schematron/LICENSE.txt | 3 + .../schematron/iso_abstract_expand.xsl | 297 +++ .../schematron/iso_dsdl_include.xsl | 1509 ++++++++++++++ .../schematron/iso_schematron_message.xsl | 55 + .../iso_schematron_skeleton_for_xslt1.xsl | 1844 +++++++++++++++++ .../schematron/iso_svrl_for_xslt1.xsl | 605 ++++++ profileValidator/schematron/readme.txt | 101 + .../schematron/schematron-skeleton-api.htm | 723 +++++++ profileValidator/validateXmlWithProfile.sh | 27 + 11 files changed, 5316 insertions(+) create mode 100644 profileValidator/schematron/ExtractSchFromRNG.xsl create mode 100644 profileValidator/schematron/ExtractSchFromXSD.xsl create mode 100644 profileValidator/schematron/LICENSE.txt create mode 100644 profileValidator/schematron/iso_abstract_expand.xsl create mode 100644 profileValidator/schematron/iso_dsdl_include.xsl create mode 100644 profileValidator/schematron/iso_schematron_message.xsl create mode 100644 profileValidator/schematron/iso_schematron_skeleton_for_xslt1.xsl create mode 100644 profileValidator/schematron/iso_svrl_for_xslt1.xsl create mode 100644 profileValidator/schematron/readme.txt create mode 100644 profileValidator/schematron/schematron-skeleton-api.htm create mode 100755 profileValidator/validateXmlWithProfile.sh diff --git a/profileValidator/schematron/ExtractSchFromRNG.xsl b/profileValidator/schematron/ExtractSchFromRNG.xsl new file mode 100644 index 0000000..0f996f4 --- /dev/null +++ b/profileValidator/schematron/ExtractSchFromRNG.xsl @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/profileValidator/schematron/ExtractSchFromXSD.xsl b/profileValidator/schematron/ExtractSchFromXSD.xsl new file mode 100644 index 0000000..e573e7c --- /dev/null +++ b/profileValidator/schematron/ExtractSchFromXSD.xsl @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/profileValidator/schematron/LICENSE.txt b/profileValidator/schematron/LICENSE.txt new file mode 100644 index 0000000..f3fe1cf --- /dev/null +++ b/profileValidator/schematron/LICENSE.txt @@ -0,0 +1,3 @@ +Open Source (OSI compliant zlib/libpng license or Apache License) + +http://www.schematron.com/implementation.html diff --git a/profileValidator/schematron/iso_abstract_expand.xsl b/profileValidator/schematron/iso_abstract_expand.xsl new file mode 100644 index 0000000..f2f1667 --- /dev/null +++ b/profileValidator/schematron/iso_abstract_expand.xsl @@ -0,0 +1,297 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Suppressed abstract pattern was here + + + + + + + Start pattern based on abstract + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/profileValidator/schematron/iso_dsdl_include.xsl b/profileValidator/schematron/iso_dsdl_include.xsl new file mode 100644 index 0000000..39f7275 --- /dev/null +++ b/profileValidator/schematron/iso_dsdl_include.xsl @@ -0,0 +1,1509 @@ + + + + + + + + + + true + true + true + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Error: Impossible URL in RELAX NG extRef + include + + + + + + + + + + + + + + Unable to open referenced included file: + + + + + + + + + Unable to locate id attribute: + + + + + + + + + + + + + Unable to open referenced included file: + + + + + + + Unable to locate id attribute: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Error: Impossible URL in Schematron include + + + + + + + + + + + + + + + + + + + Unable to open referenced included file: + + + + + + + + + + + + + Unable to locate id attribute: + + + + + + + + + + + Schema error: Use include to + include fragments, not a whole + schema + + + + + + + + + + + + + + + + + + + + Unable to open referenced included file: + + + + + + + + + + Unable to locate id attribute: + + + + + + + + + + Schema error: Use include to include + fragments, not a whole schema + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Error: Impossible URL in Schematron include + + + + + + + + + + + + + + + + + + + Unable to open referenced included file: + + + + + + + + + + + + + Unable to locate id attribute: + + + + + + + + + + + + + + + + + + + + + + + + + + + + Unable to open referenced included file: + + + + + + + + + + Unable to locate id attribute: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Error: Impossible URL in Schematron include + + + + + + + + + + + + + + Unable to open referenced included file: + + + + + + + + + Schema error: Use include to include + fragments, not a whole schema + + + + + Unable to locate id attribute: + + + + + + + + + + + + + + + + Unable to open referenced included file: + + + + + + + Schema error: Use include to include + fragments, not a whole schema + + + + + Unable to locate id attribute: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Error: Impossible URL in DTLL include + + + + + + + + + + + + + Unable to open referenced included file: + + + + + + + + + Unable to locate id attribute: + + + + + + + + + + + + + + Unable to open referenced included file: + + + + + + + Unable to locate id attribute: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Error: Impossible URL in CRDL include + + + + + + + + + + + + + + Unable to open referenced included file: + + + + + + + + + + Unable to locate id attribute: + + + + + + + + + + + + + + Unable to open referenced included file: + + + + + + Unable to locate id attribute: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fatal error: Xinclude href contains fragment + identifier # + + + + + + + Fatal error: Sorry, this software only + supports simple ids in XInclude xpointers + + + + + + + Fatal Error: Impossible URL in XInclude + include + + + + + + + + + + + + + + + + + + + + + + + + + + + Unable to open referenced included file and fallback + file: + + + + + + + Unable to open referenced included file: + + + + + + + + + + + + + + + + Unable to open referenced included file: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Error: Impossible URL in XLink embedding + link + + + + + + + + + + + + + Unable to open referenced included file: + + + + + + + + + Unable to locate id attribute: + + + + + + + + + + + + + + Unable to open referenced included file: + + + + + + + Unable to locate id attribute: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + XPath error. No XPath. + XPath error. Missing location step. Suggestion: remove '/' before '['. + + + XPath syntax error. Unclosed parenthesis. Suggestion: add ')'. + + XPath syntax error. Extra close parenthesis. Suggestion: remove ')'. + + + XPath syntax error. Unclosed left square bracket. Suggestion: add ']'. + + XPath syntax error. Extra right square bracket. Suggestion: remove ']'. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/profileValidator/schematron/iso_schematron_message.xsl b/profileValidator/schematron/iso_schematron_message.xsl new file mode 100644 index 0000000..d59b8f3 --- /dev/null +++ b/profileValidator/schematron/iso_schematron_message.xsl @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + ( + / + ) + + + \ No newline at end of file diff --git a/profileValidator/schematron/iso_schematron_skeleton_for_xslt1.xsl b/profileValidator/schematron/iso_schematron_skeleton_for_xslt1.xsl new file mode 100644 index 0000000..e337cbf --- /dev/null +++ b/profileValidator/schematron/iso_schematron_skeleton_for_xslt1.xsl @@ -0,0 +1,1844 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #ALL + + + +false + +true + + + + + true + false + + + + + + + true + false + + + + + + + + + @*| + + * + node() + *|comment()|processing-instruction() + + + + + + + + + +false + + + + + +default + +false + + + +1 + + + + + Schema error: Schematron elements in old and new namespaces found + + + + + + + + + + + + + + + + + Schema error: in the queryBinding attribute, use 'xslt' + + + + + 1.0 + + + + + + + + + This XSLT was automatically generated from a Schematron schema. + + + + + 1.0 + + + + + + + + + + Fail: This implementation of ISO Schematron does not work with + schemas using the "" query language. + + + + + Implementers: please note that overriding process-prolog or process-root is + the preferred method for meta-stylesheets to use where possible. + + + + + + + + + + PHASES + + PROLOG + + KEYS + + DEFAULT RULES + + SCHEMA METADATA + + SCHEMATRON PATTERNS + + + + + + + + + + + + + + + + + + + + + + + Phase Error: no phase with name has been defined. + + + + + + + MODE: SCHEMATRON-SELECT-FULL-PATH + This mode can be used to generate an ugly though full XPath for locators + + + + + + + + + + + + + + + + + + + + + + + + + MODE: SCHEMATRON-FULL-PATH + This mode can be used to generate an ugly though full XPath for locators + + + + + + / + + + + + + [] + + + + *[local-name()=' + ' and namespace-uri()=' + + '] + + + [] + + + + + + + + + + / + + @ + + @*[local-name()=' + + ' and namespace-uri()=' + + '] + + + + + + + + + MODE: SCHEMATRON-FULL-PATH-2 + + This mode can be used to generate prefixed XPath for humans + + + + + + / + + + [ + + ] + + + + + /@ + + + + + MODE: GENERATE-ID-FROM-PATH + + + + + + + + + + + + + + + + + + + + + + . + + + + + + + MODE: SCHEMATRON-FULL-PATH-3 + + + This mode can be used to generate prefixed XPath for humans + (Top-level element has index) + + + + + + / + + + [ + + ] + + + + + /@ + + + + + MODE: GENERATE-ID-2 + + + U + + + U + + + + + U. + + n + + + + + U. + + _ + + _ + + + + + Strip characters + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Markup Error: no pattern attribute in <active> + + + + Reference Error: the pattern "" has been activated but is not declared + + + + + + + + Markup Error: no test attribute in <assert + + + ASSERT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Markup Error: no test attribute in <report> + + + + REPORT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Markup Error: no id attribute in <diagnostic> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Markup Error: no rule attribute in <extends> + + + Reference Error: the abstract rule "" has been referenced but is not declared + + + + + + + + + + + + + + Markup Error: no name attribute in <key> + + + Markup Error: no path or use attribute in <key> + + + + + + + + + + + + + + + + Markup Error: no path or use attribute in <key> + + + + + + + + + + + + Schema error: The key element is not in the ISO Schematron namespace. Use the XSLT namespace. + + + + + + + + Schema error: Empty href= attribute for include directive. + + + + + + + + + + + + + + Error: Impossible URL in Schematron include + + + + + + + Schema error: Use include to include fragments, not a whole schema + + + + + + + + + + Schema error: Use include to include fragments, not a whole schema + + + + + + + + + + + + + + + Error: Impossible URL in Schematron include + + + + + + + Schema error: Use include to include fragments, not a whole schema + + + + + + + + + + + Schema error: Use include to include fragments, not a whole schema + + + + + + + + + + Warning: Variables should not be used with the "xpath" query language binding. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Markup Error: no uri attribute in <ns> + + + Markup Error: no prefix attribute in <ns> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + //( + + ( + + ) + | + + ) + [not(self::text())] + + + + + + + + + + + + + Schema implementation error: This schema has abstract patterns, yet they are supposed to be preprocessed out already + + + + + + + + + + PATTERN + + + + + + + + + + + + + + + + + + + + Markup Error: no id attribute in <phase> + + + + + + + + Markup Error: no context attribute in <rule> + + + RULE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Markup Error: no id attribute on abstract <rule> + + + Markup Error: (2) context attribute on abstract <rule> + + + + + + Markup Error: context attribute on abstract <rule> + + + + + + + + + + + + + + + + + + + + + + + + + + + Markup Error: no select attribute in <value-of> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Warning: + + must not contain any child elements + + + + + + + + + + + + + + + + + + + + + + + + + Reference error: A diagnostic "" has been referenced but is not declared + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Using the XSLT namespace with a prefix other than "xsl" in + Schematron rules is not supported + in this processor: + + + + + + + + + + + + + + + + + + + + Error: unrecognized element in ISO Schematron namespace: check spelling + and capitalization + + + + + + + + + + + + + Warning: unrecognized element + + + + + + + + + + + + + + + Warning: unrecognized element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TERMINATING + + + TERMINATING + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TERMINATING + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + title + + + + + + + schema-title + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/profileValidator/schematron/iso_svrl_for_xslt1.xsl b/profileValidator/schematron/iso_svrl_for_xslt1.xsl new file mode 100644 index 0000000..614649f --- /dev/null +++ b/profileValidator/schematron/iso_svrl_for_xslt1.xsl @@ -0,0 +1,605 @@ + + + + + + + + + + + + + + + + +true + + + + + + + + + + + #ALL + + +false +true +true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + xslt1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +   +   +   + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TERMINATING + + + TERMINATING + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TERMINATING + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/profileValidator/schematron/readme.txt b/profileValidator/schematron/readme.txt new file mode 100644 index 0000000..f3d4d72 --- /dev/null +++ b/profileValidator/schematron/readme.txt @@ -0,0 +1,101 @@ +

ISO SCHEMATRON 2010

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

+
+
+
+
+ + \ No newline at end of file diff --git a/profileValidator/validateXmlWithProfile.sh b/profileValidator/validateXmlWithProfile.sh new file mode 100755 index 0000000..18fd3b0 --- /dev/null +++ b/profileValidator/validateXmlWithProfile.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +XML=$1 +PROFILE=$2 + +TEMPDIR=`mktemp -d` + +#transform the profile to xslt +xsltproc -o $TEMPDIR/step1.xsl $YOUSEE_HOME/components/profileValidator/schematron/iso_dsdl_include.xsl $PROFILE +xsltproc -o $TEMPDIR/step2.xsl $YOUSEE_HOME/components/profileValidator/schematron/iso_abstract_expand.xsl $TEMPDIR/step1.xsl +xsltproc -o $TEMPDIR/step3.xsl $YOUSEE_HOME/components/profileValidator/schematron/iso_schematron_message.xsl $TEMPDIR/step2.xsl + +#evaluate the profile +xsltproc $TEMPDIR/step3.xsl $XML 2> $TEMPDIR/result.xml + + +if [ -s $TEMPDIR/result.xml ]; then + cat $TEMPDIR/result.xml + rm -r $TEMPDIR +else + echo "{" + echo "\"valid\" : true" + echo "}" + rm -r $TEMPDIR +fi + +