source: qrda/schematron/iso_schematron_text.xsl@ 1245

Last change on this file since 1245 was 906, checked in by George Lilly, 14 years ago

initial QRDA schematron checking

File size: 5.3 KB
RevLine 
[906]1<?xml version="1.0" ?>
2<!--
3 Schematron Text-only Report - iso_schematron_text.xsl
4
5 Implementation of Schematron validation that reports in text only, optionally with paths in
6 a prefix form.
7
8 This ISO Standard is available free as a Publicly Available Specification in PDF from ISO.
9 Also see www.schematron.com for drafts and other information.
10
11 This implementation of text is designed to run with the "Skeleton" implementation
12 of Schematron which Oliver Becker devised. The skeleton code provides a
13 Schematron implementation but with named templates for handling all output;
14 the skeleton provides basic templates for output using this API, but client
15 validators can be written to import the skeleton and override the default output
16 templates as required. (In order to understand this, you must understand that
17 a named template such as "process-assert" in this XSLT stylesheet overrides and
18 replaces any template with the same name in the imported skeleton XSLT file.)
19
20 History:
21 2007-02-09:
22 * GKH Repair documentation regarding termination
23 * GKH Take advantage of new stylesheetbody mode to set the output
24 method to be text
25 2007-02-08:
26 * RJ Add optimize parameter and update to use get-schematron-full-path-2
27 * RJ Add command-line parameter to select between the two path types
28 * RJ Validate against RNC schemas for XSLT 1 and 2 (with regex tests removed)
29 2007-02-07:
30 * GKH created from iso-schematron_terminator.xsl
31 2007-01-19:
32 * RJ Created from iso_svrl.xslt base
33
34-->
35<!--
36 Copyright (c) 2007 Rick Jelliffe
37
38 This software is provided 'as-is', without any express or implied warranty.
39 In no event will the authors be held liable for any damages arising from
40 the use of this software.
41
42 Permission is granted to anyone to use this software for any purpose,
43 including commercial applications, and to alter it and redistribute it freely,
44 subject to the following restrictions:
45
46 1. The origin of this software must not be misrepresented; you must not claim
47 that you wrote the original software. If you use this software in a product,
48 an acknowledgment in the product documentation would be appreciated but is
49 not required.
50
51 2. Altered source versions must be plainly marked as such, and must not be
52 misrepresented as being the original software.
53
54 3. This notice may not be removed or altered from any source distribution.
55-->
56
57
58<!-- The command-line parameters are:
59 phase NMTOKEN | "#ALL" (default) Select the phase for validation
60 diagnose=true|false Add the diagnostics to the assertion test in reports
61 generate-paths=true|false suffix messages with ":" and the Xpath
62 path-format=1|2 Which built-in path display method to use. 1 is for computers. 2 is for humans.
63 message-newline=true|false add an extra newline to the end of the message
64 sch.exslt.imports semi-colon delimited string of filenames for some EXSLT implementations
65 optimize "visit-no-attributes" Use only when the schema has no attributes as the context nodes
66
67-->
68
69<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
70 xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias"
71 xmlns:sch="http://www.ascc.net/xml/schematron"
72 xmlns:iso="http://purl.oclc.org/dsdl/schematron">
73 <!-- Select the import statement and adjust the path as
74 necessary for your system.
75 -->
76 <xsl:import href="iso_schematron_skeleton.xsl"/>
77 <!--
78 <xsl:import href="skeleton1-5.xsl"/>
79 <xsl:import href="skeleton1-6.xsl"/> -->
80 <xsl:param name="diagnose">yes</xsl:param>
81 <xsl:param name="phase">
82 <xsl:choose>
83 <!-- Handle Schematron 1.5 and 1.6 phases -->
84 <xsl:when test="//sch:schema/@defaultPhase">
85 <xsl:value-of select="//sch:schema/@defaultPhase"/>
86 </xsl:when>
87 <!-- Handle ISO Schematron phases -->
88 <xsl:when test="//iso:schema/@defaultPhase">
89 <xsl:value-of select="//iso:schema/@defaultPhase"/>
90 </xsl:when>
91 <xsl:otherwise>#ALL</xsl:otherwise>
92 </xsl:choose>
93 </xsl:param>
94 <xsl:param name="generate-paths">true</xsl:param>
95 <xsl:param name="path-format">1</xsl:param>
96 <xsl:param name="message-newline">true</xsl:param>
97 <xsl:param name="optimize" />
98 <!-- e.g. saxon file.xml file.xsl "sch.exslt.imports=.../string.xsl;.../math.xsl" -->
99 <xsl:param name="sch.exslt.imports"/>
100
101 <xsl:template match="node()" mode="stylesheetbody">
102 <xsl:comment>Importing stylesheet additions</xsl:comment>
103 <axsl:output method="text"/>
104 <!--create the remainder of the stylesheet-->
105 <xsl:apply-imports/>
106 </xsl:template>
107
108 <!-- default output action: output all messages in simple text -->
109 <xsl:template name="process-message">
110 <xsl:apply-templates mode="text"/>
111 <xsl:choose>
112 <xsl:when test=" $generate-paths = 'true' and $path-format = '2' ">
113 <axsl:text>: </axsl:text>
114 <axsl:apply-templates select="." mode="schematron-get-full-path-2" />
115 </xsl:when>
116 <xsl:when test=" $generate-paths = 'true' ">
117 <axsl:text>: </axsl:text>
118 <axsl:apply-templates select="." mode="schematron-get-full-path" />
119 </xsl:when>
120 </xsl:choose>
121 <xsl:if test=" $message-newline = 'true'" >
122 <axsl:value-of select="string('&#10;')"/>
123 </xsl:if>
124 </xsl:template>
125</xsl:stylesheet>
126
Note: See TracBrowser for help on using the repository browser.