cqm-validators 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +7 -0
  3. data/Gemfile +6 -0
  4. data/LICENSE.txt +201 -0
  5. data/QRDA_Schematron_License.txt +191 -0
  6. data/README.md +40 -0
  7. data/Rakefile +10 -0
  8. data/bin/console +14 -0
  9. data/bin/setup +8 -0
  10. data/cqm_validators.gemspec +28 -0
  11. data/lib/base_validator.rb +22 -0
  12. data/lib/cqm_validators.rb +15 -0
  13. data/lib/cqm_validators/version.rb +3 -0
  14. data/lib/data_validator.rb +82 -0
  15. data/lib/measure_validator.rb +130 -0
  16. data/lib/performance_rate_validator.rb +92 -0
  17. data/lib/qrda_qdm_template_validator.rb +320 -0
  18. data/lib/reported_result_extractor.rb +172 -0
  19. data/lib/schema/infrastructure/cda/CDA_SDTC.xsd +44 -0
  20. data/lib/schema/infrastructure/cda/POCD_MT000040_SDTC.xsd +1500 -0
  21. data/lib/schema/infrastructure/cda/SDTC.xsd +210 -0
  22. data/lib/schema/processable/coreschemas/NarrativeBlock.xsd +557 -0
  23. data/lib/schema/processable/coreschemas/datatypes-base_SDTC.xsd +1850 -0
  24. data/lib/schema/processable/coreschemas/datatypes.xsd +1375 -0
  25. data/lib/schema/processable/coreschemas/infrastructureRoot.xsd +27 -0
  26. data/lib/schema/processable/coreschemas/voc.xsd +2124 -0
  27. data/lib/schema_validator.rb +23 -0
  28. data/lib/schematron/c_processor.rb +26 -0
  29. data/lib/schematron/iso-schematron-xslt1/ExtractSchFromRNG.xsl +75 -0
  30. data/lib/schematron/iso-schematron-xslt1/ExtractSchFromXSD.xsl +77 -0
  31. data/lib/schematron/iso-schematron-xslt1/iso_abstract_expand.xsl +297 -0
  32. data/lib/schematron/iso-schematron-xslt1/iso_dsdl_include.xsl +1509 -0
  33. data/lib/schematron/iso-schematron-xslt1/iso_schematron_message.xsl +55 -0
  34. data/lib/schematron/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl +1844 -0
  35. data/lib/schematron/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl +605 -0
  36. data/lib/schematron/iso-schematron-xslt1/readme.txt +101 -0
  37. data/lib/schematron/iso-schematron-xslt1/schematron-skeleton-api.htm +723 -0
  38. data/lib/schematron/iso-schematron-xslt2/ExtractSchFromRNG-2.xsl +75 -0
  39. data/lib/schematron/iso-schematron-xslt2/ExtractSchFromXSD-2.xsl +77 -0
  40. data/lib/schematron/iso-schematron-xslt2/iso_abstract_expand.xsl +297 -0
  41. data/lib/schematron/iso-schematron-xslt2/iso_dsdl_include.xsl +1508 -0
  42. data/lib/schematron/iso-schematron-xslt2/iso_schematron_message_xslt2.xsl +55 -0
  43. data/lib/schematron/iso-schematron-xslt2/iso_schematron_skeleton_for_saxon.xsl +2299 -0
  44. data/lib/schematron/iso-schematron-xslt2/iso_svrl_for_xslt2.xsl +684 -0
  45. data/lib/schematron/iso-schematron-xslt2/readme.txt +100 -0
  46. data/lib/schematron/iso-schematron-xslt2/sch-messages-cs.xhtml +56 -0
  47. data/lib/schematron/iso-schematron-xslt2/sch-messages-de.xhtml +57 -0
  48. data/lib/schematron/iso-schematron-xslt2/sch-messages-en.xhtml +57 -0
  49. data/lib/schematron/iso-schematron-xslt2/sch-messages-fr.xhtml +54 -0
  50. data/lib/schematron/iso-schematron-xslt2/sch-messages-nl.xhtml +58 -0
  51. data/lib/schematron/iso-schematron-xslt2/schematron-skeleton-api.htm +723 -0
  52. data/lib/schematron/java_processor.rb +92 -0
  53. data/lib/schematron/qrda/cat_1/HL7_CDAR2_QRDA_Category_I_2_12_16.sch +4693 -0
  54. data/lib/schematron/qrda/cat_1/voc.xml +1177 -0
  55. data/lib/schematron/qrda/cat_1_r2/QRDA Category I Release 2.sch +4069 -0
  56. data/lib/schematron/qrda/cat_1_r2/voc.xml +1065 -0
  57. data/lib/schematron/qrda/cat_1_r3_1/HL7 QRDA Category I STU 3.1.sch +3573 -0
  58. data/lib/schematron/qrda/cat_1_r3_1/HL7 QRDA Category III STU 1.1.sch +464 -0
  59. data/lib/schematron/qrda/cat_1_r3_1/QRDA Category I STU Release 3.1.sch +5394 -0
  60. data/lib/schematron/qrda/cat_1_r3_1/voc.xml +1229 -0
  61. data/lib/schematron/qrda/cat_1_r4/HL7 QRDA Category I STU 4.sch +3526 -0
  62. data/lib/schematron/qrda/cat_1_r4/voc.xml +1186 -0
  63. data/lib/schematron/qrda/cat_1_r5/HL7 QRDA Category I STU 5.sch +3069 -0
  64. data/lib/schematron/qrda/cat_1_r5/voc.xml +1186 -0
  65. data/lib/schematron/qrda/cat_3/QRDA Category III.sch +675 -0
  66. data/lib/schematron/qrda/cat_3/voc.xml +21 -0
  67. data/lib/schematron/qrda/cat_3_r1_1/HL7 QRDA Category III STU 1.1.sch +528 -0
  68. data/lib/schematron/qrda/cat_3_r1_1/voc.xml +8 -0
  69. data/lib/schematron/qrda/cat_3_r2/HL7 QRDA Category III STU 2.sch +677 -0
  70. data/lib/schematron/qrda/cat_3_r2/voc.xml +1186 -0
  71. data/lib/schematron/qrda/cat_3_r2_1/HL7 QRDA Category III STU 2.1.sch +678 -0
  72. data/lib/schematron/qrda/cat_3_r2_1/voc.xml +1186 -0
  73. data/lib/schematron_validator.rb +38 -0
  74. data/lib/validation_error.rb +10 -0
  75. data/lib/validators.rb +136 -0
  76. metadata +177 -0
@@ -0,0 +1,605 @@
1
+ <?xml version="1.0" ?>
2
+ <!--
3
+ ISO_SVRL.xsl
4
+
5
+ Implementation of Schematron Validation Report Language from ISO Schematron
6
+ ISO/IEC 19757 Document Schema Definition Languages (DSDL)
7
+ Part 3: Rule-based validation Schematron
8
+ Annex D: Schematron Validation Report Language
9
+
10
+ This ISO Standard is available free as a Publicly Available Specification in PDF from ISO.
11
+ Also see www.schematron.com for drafts and other information.
12
+
13
+ This implementation of SVRL is designed to run with the "Skeleton" implementation
14
+ of Schematron which Oliver Becker devised. The skeleton code provides a
15
+ Schematron implementation but with named templates for handling all output;
16
+ the skeleton provides basic templates for output using this API, but client
17
+ validators can be written to import the skeleton and override the default output
18
+ templates as required. (In order to understand this, you must understand that
19
+ a named template such as "process-assert" in this XSLT stylesheet overrides and
20
+ replaces any template with the same name in the imported skeleton XSLT file.)
21
+
22
+ The other important thing to understand in this code is that there are different
23
+ versions of the Schematron skeleton. These track the development of Schematron through
24
+ Schematron 1.5, Schematron 1.6 and now ISO Schematron. One only skeleton must be
25
+ imported. The code has templates for the different skeletons commented out for
26
+ convenience. ISO Schematron has a different namespace than Schematron 1.5 and 1.6;
27
+ so the ISO Schematron skeleton has been written itself with an optional import
28
+ statement to in turn import the Schematron 1.6 skeleton. This will allow you to
29
+ validate with schemas from either namespace.
30
+
31
+
32
+ History:
33
+ 2010-04-14
34
+ * Add command line parameter 'terminate' which will terminate on first failed
35
+ assert and (optionally) successful report.
36
+ 2009-03-18
37
+ * Fix atrribute with space "see " which generates wrong name in some processors
38
+ 2008-08-11
39
+ * RJ Fix attribute/@select which saxon allows in XSLT 1
40
+ 2008-08-07
41
+ * RJ Add output-encoding attribute to specify final encoding to use
42
+ * Alter allow-foreign functionality so that Schematron span, emph and dir elements make
43
+ it to the output, for better formatting and because span can be used to mark up
44
+ semantically interesting information embedded in diagnostics, which reduces the
45
+ need to extend SVRL itself
46
+ * Diagnostic-reference had an invalid attribute @id that duplicated @diagnostic: removed
47
+ 2008-08-06
48
+ * RJ Fix invalid output: svrl:diagnostic-reference is not contained in an svrl:text
49
+ * Output comment to SVRL file giving filename if available (from command-line parameter)
50
+ 2008-08-04
51
+ * RJ move sch: prefix to schold: prefix to prevent confusion (we want people to
52
+ be able to switch from old namespace to new namespace without changing the
53
+ sch: prefix, so it is better to keep that prefix completely out of the XSLT)
54
+ * Extra signature fixes (PH)
55
+ 2008-08-03
56
+ * Repair missing class parameter on process-p
57
+ 2008-07-31
58
+ * Update skeleton names
59
+ 2007-04-03
60
+ * Add option generate-fired-rule (RG)
61
+ 2007-02-07
62
+ * Prefer true|false for parameters. But allow yes|no on some old for compatability
63
+ * DP Diagnostics output to svrl:text. Diagnosis put out after assertion text.
64
+ * Removed non-SVRL elements and attributes: better handled as an extra layer that invokes this one
65
+ * Add more formal parameters
66
+ * Correct confusion between $schemaVersion and $queryBinding
67
+ * Indent
68
+ * Validate against RNC schemas for XSLT 1 and 2 (with regex tests removed)
69
+ * Validate output with UniversalTest.sch against RNC schema for ISO SVRL
70
+
71
+ 2007-02-01
72
+ * DP. Update formal parameters of overriding named templates to handle more attributes.
73
+ * DP. Refactor handling of rich and linkable parameters to a named template.
74
+
75
+ 2007-01-22
76
+ * DP change svrl:ns to svrl:ns-in-attribute-value
77
+ * Change default when no queryBinding from "unknown" to "xslt"
78
+
79
+ 2007-01-18:
80
+ * Improve documentation
81
+ * KH Add command-line options to generate paths or not
82
+ * Use axsl:attribute rather than xsl:attribute to shut XSLT2 up
83
+ * Add extra command-line options to pass to the iso_schematron_skeleton
84
+
85
+ 2006-12-01: iso_svrl.xsl Rick Jelliffe,
86
+ * update namespace,
87
+ * update phase handling,
88
+ * add flag param to process-assert and process-report & @ flag on output
89
+
90
+ 2001: Conformance1-5.xsl Rick Jelliffe,
91
+ * Created, using the skeleton code contributed by Oliver Becker
92
+ -->
93
+ <!--
94
+ Derived from Conformance1-5.xsl.
95
+
96
+ Copyright (c) 2001-2010 Rick Jelliffe and Academia Sinica Computing Center, Taiwan
97
+
98
+ This software is provided 'as-is', without any express or implied warranty.
99
+ In no event will the authors be held liable for any damages arising from
100
+ the use of this software.
101
+
102
+ Permission is granted to anyone to use this software for any purpose,
103
+ including commercial applications, and to alter it and redistribute it freely,
104
+ subject to the following restrictions:
105
+
106
+ 1. The origin of this software must not be misrepresented; you must not claim
107
+ that you wrote the original software. If you use this software in a product,
108
+ an acknowledgment in the product documentation would be appreciated but is
109
+ not required.
110
+
111
+ 2. Altered source versions must be plainly marked as such, and must not be
112
+ misrepresented as being the original software.
113
+
114
+ 3. This notice may not be removed or altered from any source distribution.
115
+ -->
116
+
117
+ <!-- Ideas nabbed from schematrons by Francis N., Miloslav N. and David C. -->
118
+
119
+ <!-- The command-line parameters are:
120
+ phase NMTOKEN | "#ALL" (default) Select the phase for validation
121
+ allow-foreign "true" | "false" (default) Pass non-Schematron elements and rich markup to the generated stylesheet
122
+ diagnose= true | false|yes|no Add the diagnostics to the assertion test in reports (yes|no are obsolete)
123
+ generate-paths=true|false|yes|no generate the @location attribute with XPaths (yes|no are obsolete)
124
+ sch.exslt.imports semi-colon delimited string of filenames for some EXSLT implementations
125
+ optimize "visit-no-attributes" Use only when the schema has no attributes as the context nodes
126
+ generate-fired-rule "true"(default) | "false" Generate fired-rule elements
127
+ terminate= yes | no | true | false | assert Terminate on the first failed assertion or successful report
128
+ Note: whether any output at all is generated depends on the XSLT implementation.
129
+ -->
130
+
131
+ <xsl:stylesheet
132
+ version="1.0"
133
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
134
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
135
+ xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias"
136
+ xmlns:schold="http://www.ascc.net/xml/schematron"
137
+ xmlns:iso="http://purl.oclc.org/dsdl/schematron"
138
+ xmlns:svrl="http://purl.oclc.org/dsdl/svrl"
139
+ >
140
+
141
+ <!-- Select the import statement and adjust the path as
142
+ necessary for your system.
143
+ If not XSLT2 then also remove svrl:active-pattern/@document="{document-uri()}" from process-pattern()
144
+ -->
145
+ <!--
146
+ <xsl:import href="iso_schematron_skeleton_for_saxon.xsl"/>
147
+ -->
148
+
149
+ <xsl:import href="iso_schematron_skeleton_for_xslt1.xsl"/>
150
+ <!--
151
+ <xsl:import href="iso_schematron_skeleton.xsl"/>
152
+ <xsl:import href="skeleton1-5.xsl"/>
153
+ <xsl:import href="skeleton1-6.xsl"/>
154
+ -->
155
+
156
+ <xsl:param name="diagnose" >true</xsl:param>
157
+ <xsl:param name="phase" >
158
+ <xsl:choose>
159
+ <!-- Handle Schematron 1.5 and 1.6 phases -->
160
+ <xsl:when test="//schold:schema/@defaultPhase">
161
+ <xsl:value-of select="//schold:schema/@defaultPhase"/>
162
+ </xsl:when>
163
+ <!-- Handle ISO Schematron phases -->
164
+ <xsl:when test="//iso:schema/@defaultPhase">
165
+ <xsl:value-of select="//iso:schema/@defaultPhase"/>
166
+ </xsl:when>
167
+ <xsl:otherwise>#ALL</xsl:otherwise>
168
+ </xsl:choose>
169
+ </xsl:param>
170
+ <xsl:param name="allow-foreign" >false</xsl:param>
171
+ <xsl:param name="generate-paths" >true</xsl:param>
172
+ <xsl:param name="generate-fired-rule" >true</xsl:param>
173
+ <xsl:param name="optimize"/>
174
+
175
+ <xsl:param name="output-encoding" ></xsl:param>
176
+
177
+ <!-- e.g. saxon file.xml file.xsl "sch.exslt.imports=.../string.xsl;.../math.xsl" -->
178
+ <xsl:param name="sch.exslt.imports" />
179
+
180
+
181
+
182
+ <!-- Experimental: If this file called, then must be generating svrl -->
183
+ <xsl:variable name="svrlTest" select="true()" />
184
+
185
+
186
+
187
+ <!-- ================================================================ -->
188
+
189
+ <xsl:template name="process-prolog">
190
+ <axsl:output method="xml" omit-xml-declaration="no" standalone="yes"
191
+ indent="yes">
192
+ <xsl:if test=" string-length($output-encoding) &gt; 0">
193
+ <xsl:attribute name="encoding"><xsl:value-of select=" $output-encoding" /></xsl:attribute>
194
+ </xsl:if>
195
+ </axsl:output>
196
+
197
+ </xsl:template>
198
+
199
+ <!-- Overrides skeleton.xsl -->
200
+ <xsl:template name="process-root">
201
+ <xsl:param name="title"/>
202
+ <xsl:param name="contents" />
203
+ <xsl:param name="queryBinding" >xslt1</xsl:param>
204
+ <xsl:param name="schemaVersion" />
205
+ <xsl:param name="id" />
206
+ <xsl:param name="version"/>
207
+ <!-- "Rich" parameters -->
208
+ <xsl:param name="fpi" />
209
+ <xsl:param name="icon" />
210
+ <xsl:param name="lang" />
211
+ <xsl:param name="see" />
212
+ <xsl:param name="space" />
213
+
214
+ <svrl:schematron-output title="{$title}" schemaVersion="{$schemaVersion}" >
215
+ <xsl:if test=" string-length( normalize-space( $phase )) &gt; 0 and
216
+ not( normalize-space( $phase ) = '#ALL') ">
217
+ <axsl:attribute name="phase">
218
+ <xsl:value-of select=" $phase " />
219
+ </axsl:attribute>
220
+ </xsl:if>
221
+ <xsl:if test=" $allow-foreign = 'true'">
222
+ </xsl:if>
223
+ <xsl:if test=" $allow-foreign = 'true'">
224
+
225
+ <xsl:call-template name='richParms'>
226
+ <xsl:with-param name="fpi" select="$fpi" />
227
+ <xsl:with-param name="icon" select="$icon"/>
228
+ <xsl:with-param name="lang" select="$lang"/>
229
+ <xsl:with-param name="see" select="$see" />
230
+ <xsl:with-param name="space" select="$space" />
231
+ </xsl:call-template>
232
+ </xsl:if>
233
+
234
+ <axsl:comment><axsl:value-of select="$archiveDirParameter"/> &#xA0;
235
+ <axsl:value-of select="$archiveNameParameter"/> &#xA0;
236
+ <axsl:value-of select="$fileNameParameter"/> &#xA0;
237
+ <axsl:value-of select="$fileDirParameter"/></axsl:comment>
238
+
239
+
240
+ <xsl:apply-templates mode="do-schema-p" />
241
+ <xsl:copy-of select="$contents" />
242
+ </svrl:schematron-output>
243
+ </xsl:template>
244
+
245
+
246
+ <xsl:template name="process-assert">
247
+ <xsl:param name="test"/>
248
+ <xsl:param name="diagnostics" />
249
+ <xsl:param name="id" />
250
+ <xsl:param name="flag" />
251
+ <!-- "Linkable" parameters -->
252
+ <xsl:param name="role"/>
253
+ <xsl:param name="subject"/>
254
+ <!-- "Rich" parameters -->
255
+ <xsl:param name="fpi" />
256
+ <xsl:param name="icon" />
257
+ <xsl:param name="lang" />
258
+ <xsl:param name="see" />
259
+ <xsl:param name="space" />
260
+ <svrl:failed-assert test="{$test}" >
261
+ <xsl:if test="string-length( $id ) &gt; 0">
262
+ <axsl:attribute name="id">
263
+ <xsl:value-of select=" $id " />
264
+ </axsl:attribute>
265
+ </xsl:if>
266
+ <xsl:if test=" string-length( $flag ) &gt; 0">
267
+ <axsl:attribute name="flag">
268
+ <xsl:value-of select=" $flag " />
269
+ </axsl:attribute>
270
+ </xsl:if>
271
+ <!-- Process rich attributes. -->
272
+ <xsl:call-template name="richParms">
273
+ <xsl:with-param name="fpi" select="$fpi"/>
274
+ <xsl:with-param name="icon" select="$icon"/>
275
+ <xsl:with-param name="lang" select="$lang"/>
276
+ <xsl:with-param name="see" select="$see" />
277
+ <xsl:with-param name="space" select="$space" />
278
+ </xsl:call-template>
279
+ <xsl:call-template name='linkableParms'>
280
+ <xsl:with-param name="role" select="$role" />
281
+ <xsl:with-param name="subject" select="$subject"/>
282
+ </xsl:call-template>
283
+ <xsl:if test=" $generate-paths = 'true' or $generate-paths= 'yes' ">
284
+ <!-- true/false is the new way -->
285
+ <axsl:attribute name="location">
286
+ <axsl:apply-templates select="." mode="schematron-get-full-path"/>
287
+ </axsl:attribute>
288
+ </xsl:if>
289
+
290
+ <svrl:text>
291
+ <xsl:apply-templates mode="text" />
292
+
293
+ </svrl:text>
294
+ <xsl:if test="$diagnose = 'yes' or $diagnose= 'true' ">
295
+ <!-- true/false is the new way -->
296
+ <xsl:call-template name="diagnosticsSplit">
297
+ <xsl:with-param name="str" select="$diagnostics"/>
298
+ </xsl:call-template>
299
+ </xsl:if>
300
+ </svrl:failed-assert>
301
+
302
+
303
+ <xsl:if test=" $terminate = 'yes' or $terminate = 'true' ">
304
+ <axsl:message terminate="yes">TERMINATING</axsl:message>
305
+ </xsl:if>
306
+ <xsl:if test=" $terminate = 'assert' ">
307
+ <axsl:message terminate="yes">TERMINATING</axsl:message>
308
+ </xsl:if>
309
+ </xsl:template>
310
+
311
+ <xsl:template name="process-report">
312
+ <xsl:param name="id"/>
313
+ <xsl:param name="test"/>
314
+ <xsl:param name="diagnostics"/>
315
+ <xsl:param name="flag" />
316
+ <!-- "Linkable" parameters -->
317
+ <xsl:param name="role"/>
318
+ <xsl:param name="subject"/>
319
+ <!-- "Rich" parameters -->
320
+ <xsl:param name="fpi" />
321
+ <xsl:param name="icon" />
322
+ <xsl:param name="lang" />
323
+ <xsl:param name="see" />
324
+ <xsl:param name="space" />
325
+ <svrl:successful-report test="{$test}" >
326
+ <xsl:if test=" string-length( $id ) &gt; 0">
327
+ <axsl:attribute name="id">
328
+ <xsl:value-of select=" $id " />
329
+ </axsl:attribute>
330
+ </xsl:if>
331
+ <xsl:if test=" string-length( $flag ) &gt; 0">
332
+ <axsl:attribute name="flag">
333
+ <xsl:value-of select=" $flag " />
334
+ </axsl:attribute>
335
+ </xsl:if>
336
+
337
+ <!-- Process rich attributes. -->
338
+ <xsl:call-template name="richParms">
339
+ <xsl:with-param name="fpi" select="$fpi"/>
340
+ <xsl:with-param name="icon" select="$icon"/>
341
+ <xsl:with-param name="lang" select="$lang"/>
342
+ <xsl:with-param name="see" select="$see" />
343
+ <xsl:with-param name="space" select="$space" />
344
+ </xsl:call-template>
345
+ <xsl:call-template name='linkableParms'>
346
+ <xsl:with-param name="role" select="$role" />
347
+ <xsl:with-param name="subject" select="$subject"/>
348
+ </xsl:call-template>
349
+ <xsl:if test=" $generate-paths = 'yes' or $generate-paths = 'true' ">
350
+ <!-- true/false is the new way -->
351
+ <axsl:attribute name="location">
352
+ <axsl:apply-templates select="." mode="schematron-get-full-path"/>
353
+ </axsl:attribute>
354
+ </xsl:if>
355
+
356
+ <svrl:text>
357
+ <xsl:apply-templates mode="text" />
358
+
359
+ </svrl:text>
360
+ <xsl:if test="$diagnose = 'yes' or $diagnose='true' ">
361
+ <!-- true/false is the new way -->
362
+ <xsl:call-template name="diagnosticsSplit">
363
+ <xsl:with-param name="str" select="$diagnostics"/>
364
+ </xsl:call-template>
365
+ </xsl:if>
366
+ </svrl:successful-report>
367
+
368
+
369
+ <xsl:if test=" $terminate = 'yes' or $terminate = 'true' ">
370
+ <axsl:message terminate="yes">TERMINATING</axsl:message>
371
+ </xsl:if>
372
+ </xsl:template>
373
+
374
+
375
+ <!-- Overrides skeleton -->
376
+ <xsl:template name="process-dir" >
377
+ <xsl:param name="value" />
378
+ <xsl:choose>
379
+ <xsl:when test=" $allow-foreign = 'true'">
380
+ <xsl:copy-of select="."/>
381
+ </xsl:when>
382
+
383
+ <xsl:otherwise>
384
+ <!-- We generate too much whitespace rather than risking concatenation -->
385
+ <axsl:text> </axsl:text>
386
+ <xsl:apply-templates mode="inline-text"/>
387
+ <axsl:text> </axsl:text>
388
+ </xsl:otherwise>
389
+ </xsl:choose>
390
+ </xsl:template>
391
+
392
+ <xsl:template name="process-diagnostic">
393
+ <xsl:param name="id"/>
394
+ <!-- Rich parameters -->
395
+ <xsl:param name="fpi" />
396
+ <xsl:param name="icon" />
397
+ <xsl:param name="lang" />
398
+ <xsl:param name="see" />
399
+ <xsl:param name="space" />
400
+ <svrl:diagnostic-reference diagnostic="{$id}" >
401
+
402
+ <xsl:call-template name="richParms">
403
+ <xsl:with-param name="fpi" select="$fpi"/>
404
+ <xsl:with-param name="icon" select="$icon"/>
405
+ <xsl:with-param name="lang" select="$lang"/>
406
+ <xsl:with-param name="see" select="$see" />
407
+ <xsl:with-param name="space" select="$space" />
408
+ </xsl:call-template>
409
+ <xsl:text>
410
+ </xsl:text>
411
+
412
+ <xsl:apply-templates mode="text"/>
413
+
414
+ </svrl:diagnostic-reference>
415
+ </xsl:template>
416
+
417
+
418
+ <!-- Overrides skeleton -->
419
+ <xsl:template name="process-emph" >
420
+ <xsl:param name="class" />
421
+ <xsl:choose>
422
+ <xsl:when test=" $allow-foreign = 'true'">
423
+ <xsl:copy-of select="."/>
424
+ </xsl:when>
425
+ <xsl:otherwise>
426
+ <!-- We generate too much whitespace rather than risking concatenation -->
427
+ <axsl:text> </axsl:text>
428
+ <xsl:apply-templates mode="inline-text"/>
429
+ <axsl:text> </axsl:text>
430
+ </xsl:otherwise>
431
+ </xsl:choose>
432
+ </xsl:template>
433
+
434
+ <xsl:template name="process-rule">
435
+ <xsl:param name="id"/>
436
+ <xsl:param name="context"/>
437
+ <xsl:param name="flag"/>
438
+ <!-- "Linkable" parameters -->
439
+ <xsl:param name="role"/>
440
+ <xsl:param name="subject"/>
441
+ <!-- "Rich" parameters -->
442
+ <xsl:param name="fpi" />
443
+ <xsl:param name="icon" />
444
+ <xsl:param name="lang" />
445
+ <xsl:param name="see" />
446
+ <xsl:param name="space" />
447
+ <xsl:if test=" $generate-fired-rule = 'true'">
448
+ <svrl:fired-rule context="{$context}" >
449
+ <!-- Process rich attributes. -->
450
+ <xsl:call-template name="richParms">
451
+ <xsl:with-param name="fpi" select="$fpi"/>
452
+ <xsl:with-param name="icon" select="$icon"/>
453
+ <xsl:with-param name="lang" select="$lang"/>
454
+ <xsl:with-param name="see" select="$see" />
455
+ <xsl:with-param name="space" select="$space" />
456
+ </xsl:call-template>
457
+ <xsl:if test=" string( $id )">
458
+ <xsl:attribute name="id">
459
+ <xsl:value-of select=" $id " />
460
+ </xsl:attribute>
461
+ </xsl:if>
462
+ <xsl:if test=" string-length( $role ) &gt; 0">
463
+ <xsl:attribute name="role">
464
+ <xsl:value-of select=" $role " />
465
+ </xsl:attribute>
466
+ </xsl:if>
467
+ </svrl:fired-rule>
468
+ </xsl:if>
469
+ </xsl:template>
470
+
471
+ <xsl:template name="process-ns">
472
+ <xsl:param name="prefix"/>
473
+ <xsl:param name="uri"/>
474
+ <svrl:ns-prefix-in-attribute-values uri="{$uri}" prefix="{$prefix}" />
475
+ </xsl:template>
476
+
477
+ <xsl:template name="process-p">
478
+ <xsl:param name="icon"/>
479
+ <xsl:param name="class"/>
480
+ <xsl:param name="id"/>
481
+ <xsl:param name="lang"/>
482
+
483
+ <svrl:text>
484
+ <xsl:apply-templates mode="text"/>
485
+ </svrl:text>
486
+ </xsl:template>
487
+
488
+ <xsl:template name="process-pattern">
489
+ <xsl:param name="name"/>
490
+ <xsl:param name="id"/>
491
+ <xsl:param name="is-a"/>
492
+
493
+ <!-- "Rich" parameters -->
494
+ <xsl:param name="fpi" />
495
+ <xsl:param name="icon" />
496
+ <xsl:param name="lang" />
497
+ <xsl:param name="see" />
498
+ <xsl:param name="space" />
499
+ <svrl:active-pattern >
500
+ <xsl:if test=" string( $id )">
501
+ <axsl:attribute name="id">
502
+ <xsl:value-of select=" $id " />
503
+ </axsl:attribute>
504
+ </xsl:if>
505
+ <xsl:if test=" string( $name )">
506
+ <axsl:attribute name="name">
507
+ <xsl:value-of select=" $name " />
508
+ </axsl:attribute>
509
+ </xsl:if>
510
+
511
+ <xsl:call-template name='richParms'>
512
+ <xsl:with-param name="fpi" select="$fpi"/>
513
+ <xsl:with-param name="icon" select="$icon"/>
514
+ <xsl:with-param name="lang" select="$lang"/>
515
+ <xsl:with-param name="see" select="$see" />
516
+ <xsl:with-param name="space" select="$space" />
517
+ </xsl:call-template>
518
+
519
+ <!-- ?? report that this screws up iso:title processing -->
520
+ <xsl:apply-templates mode="do-pattern-p"/>
521
+ <!-- ?? Seems that this apply-templates is never triggered DP -->
522
+ <axsl:apply-templates />
523
+ </svrl:active-pattern>
524
+ </xsl:template>
525
+
526
+ <!-- Overrides skeleton -->
527
+ <xsl:template name="process-message" >
528
+ <xsl:param name="pattern"/>
529
+ <xsl:param name="role"/>
530
+ </xsl:template>
531
+
532
+
533
+ <!-- Overrides skeleton -->
534
+ <xsl:template name="process-span" >
535
+ <xsl:param name="class" />
536
+ <xsl:choose>
537
+ <xsl:when test=" $allow-foreign = 'true'">
538
+ <xsl:copy-of select="."/>
539
+ </xsl:when>
540
+ <xsl:otherwise>
541
+ <!-- We generate too much whitespace rather than risking concatenation -->
542
+ <axsl:text> </axsl:text>
543
+ <xsl:apply-templates mode="inline-text"/>
544
+ <axsl:text> </axsl:text>
545
+ </xsl:otherwise>
546
+ </xsl:choose>
547
+ </xsl:template>
548
+
549
+ <!-- =========================================================================== -->
550
+ <!-- processing rich parameters. -->
551
+ <xsl:template name='richParms'>
552
+ <!-- "Rich" parameters -->
553
+ <xsl:param name="fpi" />
554
+ <xsl:param name="icon" />
555
+ <xsl:param name="lang" />
556
+ <xsl:param name="see" />
557
+ <xsl:param name="space" />
558
+ <!-- Process rich attributes. -->
559
+ <xsl:if test=" $allow-foreign = 'true'">
560
+ <xsl:if test="string($fpi)">
561
+ <axsl:attribute name="fpi">
562
+ <xsl:value-of select="$fpi"/>
563
+ </axsl:attribute>
564
+ </xsl:if>
565
+ <xsl:if test="string($icon)">
566
+ <axsl:attribute name="icon">
567
+ <xsl:value-of select="$icon"/>
568
+ </axsl:attribute>
569
+ </xsl:if>
570
+ <xsl:if test="string($see)">
571
+ <axsl:attribute name="see">
572
+ <xsl:value-of select="$see"/>
573
+ </axsl:attribute>
574
+ </xsl:if>
575
+ </xsl:if>
576
+ <xsl:if test="string($space)">
577
+ <axsl:attribute name="xml:space">
578
+ <xsl:value-of select="$space"/>
579
+ </axsl:attribute>
580
+ </xsl:if>
581
+ <xsl:if test="string($lang)">
582
+ <axsl:attribute name="xml:lang">
583
+ <xsl:value-of select="$lang"/>
584
+ </axsl:attribute>
585
+ </xsl:if>
586
+ </xsl:template>
587
+
588
+ <!-- processing linkable parameters. -->
589
+ <xsl:template name='linkableParms'>
590
+ <xsl:param name="role"/>
591
+ <xsl:param name="subject"/>
592
+
593
+ <!-- ISO SVRL has a role attribute to match the Schematron role attribute -->
594
+ <xsl:if test=" string($role )">
595
+ <axsl:attribute name="role">
596
+ <xsl:value-of select=" $role " />
597
+ </axsl:attribute>
598
+ </xsl:if>
599
+ <!-- ISO SVRL does not have a subject attribute to match the Schematron subject attribute.
600
+ Instead, the Schematron subject attribute is folded into the location attribute -->
601
+ </xsl:template>
602
+
603
+
604
+ </xsl:stylesheet>
605
+