Provide Maven based distribution packaging (#2)

* Provide Maven based distribution packaging
This commit is contained in:
apenski 2017-10-26 15:24:18 +02:00 committed by GitHub
parent 4eab984c01
commit 7dbcf6b6d4
13 changed files with 1148 additions and 94 deletions

View file

@ -0,0 +1,23 @@
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>konfiguration</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>test/report.sch</include>
<include>test/report.sch.xsl</include>
<include>resources/report.xsd</include>
</includes>
</fileSet>
</fileSets>
</assembly>

View file

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Koordinierungsstelle für IT-Standards (KoSIT) under
~ one or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. KoSIT licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
<parent>
<groupId>de.kosit</groupId>
<artifactId>validationtool-base</artifactId>
<version>1.0.0</version>
<relativePath>../../</relativePath>
</parent>
<name>KoSIT XRechnung Konfiguration</name>
<artifactId>xrechnung</artifactId>
<description>KoSIT XML Prüftool zur Prüfung von XML Dateien gegenüber definierten Szenarien.</description>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>assemble</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
<attach>true</attach>
<appendAssemblyId>false</appendAssemblyId>
<outputDirectory>target/</outputDirectory>
<workDirectory>target/assembly/work</workDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,265 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: report.xsd 7617 2017-09-21 12:54:43Z fbuettner $ -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rep="http://www.xoev.de/de/validator/varl/1"
xmlns:s="http://www.xoev.de/de/validator/framework/1/scenarios" targetNamespace="http://www.xoev.de/de/validator/varl/1" version="1.0.0"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:annotation>
<xs:documentation>Dieses Schema beschreibt die Struktur von Berichten, mit denen die Prüfung und Bewertung elektronischer Dokumente
nachvollziehbar dokumentiert wird.</xs:documentation>
</xs:annotation>
<xs:import namespace="http://www.xoev.de/de/validator/framework/1/scenarios" schemaLocation="scenarios.xsd"/>
<xs:element name="report">
<xs:annotation>
<xs:documentation>Prüfbericht (das einzige Wurzelelement in diesem Schema)</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="engine" type="rep:EngineType">
<xs:annotation>
<xs:documentation>Angaben zum Prüftool, mit welchem dieser Prüfbericht erstellt wurde</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="timestamp" type="xs:dateTime">
<xs:annotation>
<xs:documentation>Der Zeitpunkt, an dem die Prüfung des Dokuments begann.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="documentIdentification" type="rep:DocumentIdentificationType">
<xs:annotation>
<xs:documentation>Angaben zur eindeutigen Identifikation des geprüften Dokumentes</xs:documentation>
</xs:annotation>
</xs:element>
<xs:choice>
<xs:element name="scenarioMatched">
<xs:annotation>
<xs:documentation>Dieses Kindelement gibt an, dass das für das geprüfte Dokument ein Szenario (ein Dokumenttyp)
erkannt wurde, für welches weitere Prüfschritte durchgeführt wurden.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="s:scenario"/>
<xs:element name="documentData" type="rep:DocumentDataType" minOccurs="0">
<xs:annotation>
<xs:documentation>In diesem Element können ausgewählte extrahierte Inhaltsdaten des geprüften Dokuments in
strukturierter Form abgelegt werden.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="validationStepResult" maxOccurs="unbounded" type="rep:ValidationStepResultType">
<xs:annotation>
<xs:documentation>Für jeden durchgeführten Validierungsschrittes (z. B. einer Prüfung
gegen eine Schematron-Datei) wird ein entsprechendes
validationStepResult-Element angelegt.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="noScenarioMatched">
<xs:annotation>
<xs:documentation>Dieses Kindelement gibt an, dass das für das geprüfte Dokument kein Szenario
erkannt wurde.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="validationStepResult" minOccurs="0" type="rep:ValidationStepResultType">
<xs:annotation>
<xs:documentation>Angaben zu einer ggf. fehlgeschlagen Prüfung auf XML-Wohlgeformtheit</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
<xs:element name="assessment" type="rep:AssessmentType">
<xs:annotation>
<xs:documentation>Dieses Kindelement enthält eine Empfehlung zur Annahme oder Ablehnung des geprüften Dokuments auf Grundlage der Validierungsergebnisse.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attribute name="valid" type="xs:boolean" use="required">
<xs:annotation>
<xs:documentation>Dieses Attribut ist genau dann 'true', wenn ein Szenario (Dokumenttyp) erkannt wurde und das Attribut valid für alle zugeordneten
Validierungsschritt-Ergebnisse (rep:scenarioMatched/rep:validationStepResult) den Wert 'true' hat.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="varlVersion" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>Die Version dieses Dokumenttyps (Prüfbericht).</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:complexType name="EngineType">
<xs:sequence>
<xs:element name="name" type="xs:normalizedString"/>
<xs:element name="info" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:normalizedString">
<xs:attribute name="key" type="xs:NMTOKEN" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="AssessmentType">
<xs:sequence>
<xs:element name="customLevel" minOccurs="0" maxOccurs="3" type="s:CustomErrorLevel"/>
<xs:choice>
<xs:annotation>
<xs:documentation>Die Empfehlung zum weiteren Umgang mit dem Dokument.</xs:documentation>
</xs:annotation>
<xs:element name="accept" type="rep:RecommendationType">
<xs:annotation>
<xs:documentation>Die Existenz dieses Kindelements bedeutet, dass die Weiterverarbeitung des geprüften Dokuments empfohlen
wird.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="reject" type="rep:RecommendationType">
<xs:annotation>
<xs:documentation>Die Existenz dieses Kindelements bedeutet, dass die Ablehnung des geprüften Dokuments empfohlen
wird.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:choice>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DocumentIdentificationType">
<xs:annotation>
<xs:documentation>Dient der eindeutigen Identifikation des geprüften Dokuments anhand einer Dokumentenreferenz und seines Hashwertes.</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="documentHash">
<xs:annotation>
<xs:documentation>Angaben zum Hashwert des geprüften Dokuments.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="hashAlgorithm" type="xs:normalizedString">
<xs:annotation>
<xs:documentation>Bezeichnung des Algorithmus, mit welchem der Hashwert berechnet wurde.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="hashValue" type="xs:base64Binary">
<xs:annotation>
<xs:documentation>Der Hashwert des geprüften Dokuments bei Anwendung des bezeichneten Algorithmus.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="documentReference" type="xs:normalizedString">
<xs:annotation>
<xs:documentation>Eine von der prüfenden Organisationseinheit festgelegte, möglichst eindeutige Referenz des geprüften
Dokuments.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="MessageType">
<xs:simpleContent>
<xs:extension base="xs:normalizedString">
<xs:attribute name="id" type="xs:token" use="required">
<xs:annotation>
<xs:documentation>Prüfberichtsweit eindeutige Id dieser spezifischen Validierungsmeldung</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="code" type="xs:token" use="required">
<xs:annotation>
<xs:documentation>(Fehler-)Code der Validierungsmeldung, wie er sich aus der zugrundeliegenden
Prüfung ergibt.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="level" type="rep:ErrorLevelType" use="required">
<xs:annotation>
<xs:documentation>Art der Meldung: Fehler (error), Warnung (warning) oder Information
(information).</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="lineNumber" type="xs:int" use="optional">
<xs:annotation>
<xs:documentation>Zeilennummer der auslösenden Stelle im geprüften Dokument (falls bekannt).</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="columnNumber" type="xs:int" use="optional">
<xs:annotation>
<xs:documentation>Spaltennummer der auslösenden Stelle im geprüften Dokument (falls bekannt).</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="xpathLocation" type="xs:token" use="optional">
<xs:annotation>
<xs:documentation>XPath-Ausdruck, welcher die auslösenden Stelle im geprüften Dokument eindeutig
bestimmt (falls bekannt).</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="RecommendationType">
<xs:sequence>
<xs:element name="explanation" minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>Ein oder mehrere HTML-Dokumente, welche die Empfehlung zum weiteren Umgang mit dem Dokument
begründen. Die HTML-Dokumente müssen im Attribut 'data-report-type' des Wurzelelements eine Typ-ID für den Bericht tragen.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:any minOccurs="1" maxOccurs="1" namespace="http://www.w3.org/1999/xhtml" processContents="skip"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ValidationStepResultType">
<xs:sequence>
<xs:element ref="s:resource" maxOccurs="unbounded" minOccurs="0">
<xs:annotation>
<xs:documentation>Resource(n), mit welchen dieser Validierungsschritt durchgeführt wurde. Dies ist
ein Zitat aus der zugrunde liegenden Prüftoolkonfiguration.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element maxOccurs="unbounded" minOccurs="0" name="message" type="rep:MessageType">
<xs:annotation>
<xs:documentation>Eine Meldung, welche sich aus validierungsschritt ergeben hat.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:ID" use="required">
<xs:annotation>
<xs:documentation>Prüfberichtsweit eindeutige Id dieser spezifischen Validierungsergebnisse.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="valid" type="xs:boolean" use="required">
<xs:annotation>
<xs:documentation>Konformitätsbewertung der Ergebnisse dieses Validierungsschrittes. Das Attribut ist
genau dann 'true', wenn kein Kindelement message mit error level 'error' oder 'warning' vorliegt.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType name="DocumentDataType">
<xs:sequence>
<xs:any minOccurs="0" maxOccurs="unbounded" namespace="##any" processContents="skip"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="Tokens">
<xs:list itemType="xs:token"/>
</xs:simpleType>
<xs:simpleType name="ErrorLevelType">
<xs:restriction base="xs:token">
<xs:enumeration value="error"/>
<xs:enumeration value="warning"/>
<xs:enumeration value="information"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>

View file

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2"
xmlns:sqf="http://www.schematron-quickfix.com/validator/process">
<sch:ns uri="http://www.xoev.de/de/validator/varl/1" prefix="rep"/>
<sch:ns uri="http://www.xoev.de/de/validator/framework/1/scenarios" prefix="s"/>
<sch:pattern>
<sch:rule context="rep:report">
<sch:assert test="@varlVersion='1.0.0'">VARL version must be 1.0.0.</sch:assert>
</sch:rule>
</sch:pattern>
<sch:pattern>
<sch:rule context="rep:report[rep:noScenarioMatched]">
<sch:assert test="@valid='false'">If no scenario matched, then the report must be flagged invalid.</sch:assert>
</sch:rule>
<sch:rule context="rep:report[rep:scenarioMatched/rep:validationStepResult[@valid = 'false']]">
<sch:assert test="@valid='false'">If any validation step has been flagged invalid, then the report must be flagged invalid.</sch:assert>
</sch:rule>
<sch:rule context="rep:report[rep:scenarioMatched and empty(rep:scenarioMatched/rep:validationStepResult[@valid = 'false'])]">
<sch:assert test="@valid='true'">If a scenario matched and no validation step has been flagged invalid, then the report must be flagged valid.</sch:assert>
</sch:rule>
</sch:pattern>
<sch:pattern>
<sch:rule context="rep:scenarioMatched[rep:validationStepResult[@id = 'val-xsd' and @valid='true']]">
<sch:assert test="rep:validationStepResult[@id = 'val-sch.1']">If xsd is valid then schematron checks have to be performed.</sch:assert>
</sch:rule>
<sch:rule context="rep:scenarioMatched[rep:validationStepResult[@id = 'val-xsd' and @valid='false']]">
<sch:assert test="empty(rep:validationStepResult[@id = 'val-sch.1'])">If xsd is invalid then schematron checks must not be performed.</sch:assert>
</sch:rule>
</sch:pattern>
<sch:pattern>
<sch:rule context="rep:validationStepResult[rep:message[@level=('error','warning')]]">
<sch:assert test="@valid = 'false'">If a validation step has errors or warnings, it must be flagged invalid.</sch:assert>
</sch:rule>
<sch:rule context="rep:validationStepResult[not(rep:message[@level=('error','warning')])]">
<sch:assert test="@valid = 'true'">If a validation step has no errors or warnings, it must be flagged valid.</sch:assert>
</sch:rule>
</sch:pattern>
<sch:pattern>
<sch:rule context="rep:message">
<sch:assert test="@lineNumber or @xpathLocation">Some kind of error location must be given.</sch:assert>
</sch:rule>
</sch:pattern>
</sch:schema>

View file

@ -0,0 +1,337 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:saxon="http://saxon.sf.net/"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:schold="http://www.ascc.net/xml/schematron"
xmlns:iso="http://purl.oclc.org/dsdl/schematron"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:rep="http://www.xoev.de/de/validator/varl/1"
xmlns:s="http://www.xoev.de/de/validator/framework/1/scenarios"
version="2.0"><!--Implementers: please note that overriding process-prolog or process-root is
the preferred method for meta-stylesheets to use where possible. -->
<xsl:param name="archiveDirParameter"/>
<xsl:param name="archiveNameParameter"/>
<xsl:param name="fileNameParameter"/>
<xsl:param name="fileDirParameter"/>
<xsl:variable name="document-uri">
<xsl:value-of select="document-uri(/)"/>
</xsl:variable>
<!--PHASES-->
<!--PROLOG-->
<xsl:output method="text"/>
<!--XSD TYPES FOR XSLT2-->
<!--KEYS AND FUNCTIONS-->
<!--DEFAULT RULES-->
<!--MODE: SCHEMATRON-SELECT-FULL-PATH-->
<!--This mode can be used to generate an ugly though full XPath for locators-->
<xsl:template match="*" mode="schematron-select-full-path">
<xsl:apply-templates select="." mode="schematron-get-full-path"/>
</xsl:template>
<!--MODE: SCHEMATRON-FULL-PATH-->
<!--This mode can be used to generate an ugly though full XPath for locators-->
<xsl:template match="*" mode="schematron-get-full-path">
<xsl:apply-templates select="parent::*" mode="schematron-get-full-path"/>
<xsl:text>/</xsl:text>
<xsl:choose>
<xsl:when test="namespace-uri()=''">
<xsl:value-of select="name()"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>*:</xsl:text>
<xsl:value-of select="local-name()"/>
<xsl:text>[namespace-uri()='</xsl:text>
<xsl:value-of select="namespace-uri()"/>
<xsl:text>']</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:variable name="preceding"
select="count(preceding-sibling::*[local-name()=local-name(current()) and namespace-uri() = namespace-uri(current())])"/>
<xsl:text>[</xsl:text>
<xsl:value-of select="1+ $preceding"/>
<xsl:text>]</xsl:text>
</xsl:template>
<xsl:template match="@*" mode="schematron-get-full-path">
<xsl:apply-templates select="parent::*" mode="schematron-get-full-path"/>
<xsl:text>/</xsl:text>
<xsl:choose>
<xsl:when test="namespace-uri()=''">@<xsl:value-of select="name()"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>@*[local-name()='</xsl:text>
<xsl:value-of select="local-name()"/>
<xsl:text>' and namespace-uri()='</xsl:text>
<xsl:value-of select="namespace-uri()"/>
<xsl:text>']</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--MODE: SCHEMATRON-FULL-PATH-2-->
<!--This mode can be used to generate prefixed XPath for humans-->
<xsl:template match="node() | @*" mode="schematron-get-full-path-2">
<xsl:for-each select="ancestor-or-self::*">
<xsl:text>/</xsl:text>
<xsl:value-of select="name(.)"/>
<xsl:if test="preceding-sibling::*[name(.)=name(current())]">
<xsl:text>[</xsl:text>
<xsl:value-of select="count(preceding-sibling::*[name(.)=name(current())])+1"/>
<xsl:text>]</xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:if test="not(self::*)">
<xsl:text/>/@<xsl:value-of select="name(.)"/>
</xsl:if>
</xsl:template>
<!--MODE: SCHEMATRON-FULL-PATH-3-->
<!--This mode can be used to generate prefixed XPath for humans
(Top-level element has index)-->
<xsl:template match="node() | @*" mode="schematron-get-full-path-3">
<xsl:for-each select="ancestor-or-self::*">
<xsl:text>/</xsl:text>
<xsl:value-of select="name(.)"/>
<xsl:if test="parent::*">
<xsl:text>[</xsl:text>
<xsl:value-of select="count(preceding-sibling::*[name(.)=name(current())])+1"/>
<xsl:text>]</xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:if test="not(self::*)">
<xsl:text/>/@<xsl:value-of select="name(.)"/>
</xsl:if>
</xsl:template>
<!--MODE: GENERATE-ID-FROM-PATH -->
<xsl:template match="/" mode="generate-id-from-path"/>
<xsl:template match="text()" mode="generate-id-from-path">
<xsl:apply-templates select="parent::*" mode="generate-id-from-path"/>
<xsl:value-of select="concat('.text-', 1+count(preceding-sibling::text()), '-')"/>
</xsl:template>
<xsl:template match="comment()" mode="generate-id-from-path">
<xsl:apply-templates select="parent::*" mode="generate-id-from-path"/>
<xsl:value-of select="concat('.comment-', 1+count(preceding-sibling::comment()), '-')"/>
</xsl:template>
<xsl:template match="processing-instruction()" mode="generate-id-from-path">
<xsl:apply-templates select="parent::*" mode="generate-id-from-path"/>
<xsl:value-of select="concat('.processing-instruction-', 1+count(preceding-sibling::processing-instruction()), '-')"/>
</xsl:template>
<xsl:template match="@*" mode="generate-id-from-path">
<xsl:apply-templates select="parent::*" mode="generate-id-from-path"/>
<xsl:value-of select="concat('.@', name())"/>
</xsl:template>
<xsl:template match="*" mode="generate-id-from-path" priority="-0.5">
<xsl:apply-templates select="parent::*" mode="generate-id-from-path"/>
<xsl:text>.</xsl:text>
<xsl:value-of select="concat('.',name(),'-',1+count(preceding-sibling::*[name()=name(current())]),'-')"/>
</xsl:template>
<!--MODE: GENERATE-ID-2 -->
<xsl:template match="/" mode="generate-id-2">U</xsl:template>
<xsl:template match="*" mode="generate-id-2" priority="2">
<xsl:text>U</xsl:text>
<xsl:number level="multiple" count="*"/>
</xsl:template>
<xsl:template match="node()" mode="generate-id-2">
<xsl:text>U.</xsl:text>
<xsl:number level="multiple" count="*"/>
<xsl:text>n</xsl:text>
<xsl:number count="node()"/>
</xsl:template>
<xsl:template match="@*" mode="generate-id-2">
<xsl:text>U.</xsl:text>
<xsl:number level="multiple" count="*"/>
<xsl:text>_</xsl:text>
<xsl:value-of select="string-length(local-name(.))"/>
<xsl:text>_</xsl:text>
<xsl:value-of select="translate(name(),':','.')"/>
</xsl:template>
<!--Strip characters-->
<xsl:template match="text()" priority="-1"/>
<!--SCHEMA SETUP-->
<xsl:template match="/">
<xsl:apply-templates select="/" mode="M2"/>
<xsl:apply-templates select="/" mode="M3"/>
<xsl:apply-templates select="/" mode="M4"/>
<xsl:apply-templates select="/" mode="M5"/>
<xsl:apply-templates select="/" mode="M6"/>
</xsl:template>
<!--SCHEMATRON PATTERNS-->
<!--PATTERN -->
<!--RULE -->
<xsl:template match="rep:report" priority="1000" mode="M2">
<!--ASSERT -->
<xsl:choose>
<xsl:when test="@varlVersion='1.0.0'"/>
<xsl:otherwise>
<xsl:message>Schematron rule violation on <xsl:value-of select="document-uri(root(.))"/> VARL version must be 1.0.0. (@varlVersion='1.0.0')</xsl:message>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="*" mode="M2"/>
</xsl:template>
<xsl:template match="text()" priority="-1" mode="M2"/>
<xsl:template match="@*|node()" priority="-2" mode="M2">
<xsl:apply-templates select="*" mode="M2"/>
</xsl:template>
<!--PATTERN -->
<!--RULE -->
<xsl:template match="rep:report[rep:noScenarioMatched]" priority="1002" mode="M3">
<!--ASSERT -->
<xsl:choose>
<xsl:when test="@valid='false'"/>
<xsl:otherwise>
<xsl:message>Schematron rule violation on <xsl:value-of select="document-uri(root(.))"/> If no scenario matched, then the report must be flagged invalid. (@valid='false')</xsl:message>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="*" mode="M3"/>
</xsl:template>
<!--RULE -->
<xsl:template match="rep:report[rep:scenarioMatched/rep:validationStepResult[@valid = 'false']]"
priority="1001"
mode="M3">
<!--ASSERT -->
<xsl:choose>
<xsl:when test="@valid='false'"/>
<xsl:otherwise>
<xsl:message>Schematron rule violation on <xsl:value-of select="document-uri(root(.))"/> If any validation step has been flagged invalid, then the report must be flagged invalid. (@valid='false')</xsl:message>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="*" mode="M3"/>
</xsl:template>
<!--RULE -->
<xsl:template match="rep:report[rep:scenarioMatched and empty(rep:scenarioMatched/rep:validationStepResult[@valid = 'false'])]"
priority="1000"
mode="M3">
<!--ASSERT -->
<xsl:choose>
<xsl:when test="@valid='true'"/>
<xsl:otherwise>
<xsl:message>Schematron rule violation on <xsl:value-of select="document-uri(root(.))"/> If a scenario matched and no validation step has been flagged invalid, then the report must be flagged valid. (@valid='true')</xsl:message>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="*" mode="M3"/>
</xsl:template>
<xsl:template match="text()" priority="-1" mode="M3"/>
<xsl:template match="@*|node()" priority="-2" mode="M3">
<xsl:apply-templates select="*" mode="M3"/>
</xsl:template>
<!--PATTERN -->
<!--RULE -->
<xsl:template match="rep:scenarioMatched[rep:validationStepResult[@id = 'val-xsd' and @valid='true']]"
priority="1001"
mode="M4">
<!--ASSERT -->
<xsl:choose>
<xsl:when test="rep:validationStepResult[@id = 'val-sch.1']"/>
<xsl:otherwise>
<xsl:message>Schematron rule violation on <xsl:value-of select="document-uri(root(.))"/> If xsd is valid then schematron checks have to be performed. (rep:validationStepResult[@id = 'val-sch.1'])</xsl:message>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="*" mode="M4"/>
</xsl:template>
<!--RULE -->
<xsl:template match="rep:scenarioMatched[rep:validationStepResult[@id = 'val-xsd' and @valid='false']]"
priority="1000"
mode="M4">
<!--ASSERT -->
<xsl:choose>
<xsl:when test="empty(rep:validationStepResult[@id = 'val-sch.1'])"/>
<xsl:otherwise>
<xsl:message>Schematron rule violation on <xsl:value-of select="document-uri(root(.))"/> If xsd is invalid then schematron checks must not be performed. (empty(rep:validationStepResult[@id = 'val-sch.1']))</xsl:message>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="*" mode="M4"/>
</xsl:template>
<xsl:template match="text()" priority="-1" mode="M4"/>
<xsl:template match="@*|node()" priority="-2" mode="M4">
<xsl:apply-templates select="*" mode="M4"/>
</xsl:template>
<!--PATTERN -->
<!--RULE -->
<xsl:template match="rep:validationStepResult[rep:message[@level=('error','warning')]]"
priority="1001"
mode="M5">
<!--ASSERT -->
<xsl:choose>
<xsl:when test="@valid = 'false'"/>
<xsl:otherwise>
<xsl:message>Schematron rule violation on <xsl:value-of select="document-uri(root(.))"/> If a validation step has errors or warnings, it must be flagged invalid. (@valid = 'false')</xsl:message>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="*" mode="M5"/>
</xsl:template>
<!--RULE -->
<xsl:template match="rep:validationStepResult[not(rep:message[@level=('error','warning')])]"
priority="1000"
mode="M5">
<!--ASSERT -->
<xsl:choose>
<xsl:when test="@valid = 'true'"/>
<xsl:otherwise>
<xsl:message>Schematron rule violation on <xsl:value-of select="document-uri(root(.))"/> If a validation step has no errors or warnings, it must be flagged valid. (@valid = 'true')</xsl:message>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="*" mode="M5"/>
</xsl:template>
<xsl:template match="text()" priority="-1" mode="M5"/>
<xsl:template match="@*|node()" priority="-2" mode="M5">
<xsl:apply-templates select="*" mode="M5"/>
</xsl:template>
<!--PATTERN -->
<!--RULE -->
<xsl:template match="rep:message" priority="1000" mode="M6">
<!--ASSERT -->
<xsl:choose>
<xsl:when test="@lineNumber or @xpathLocation"/>
<xsl:otherwise>
<xsl:message>Schematron rule violation on <xsl:value-of select="document-uri(root(.))"/> Some kind of error location must be given. (@lineNumber or @xpathLocation)</xsl:message>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="*" mode="M6"/>
</xsl:template>
<xsl:template match="text()" priority="-1" mode="M6"/>
<xsl:template match="@*|node()" priority="-2" mode="M6">
<xsl:apply-templates select="*" mode="M6"/>
</xsl:template>
</xsl:stylesheet>