schematron-wrapper 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,684 @@
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
+ * rename allow-foreign to allow-rich
39
+
40
+ 2009-02-19
41
+ * RJ add experimental non-standard attribute active-pattern/@document which says which
42
+ document is being validated from that point to the next similar. This is to cope with the
43
+ experimental multi-document validation in the XSLT2 skeleton.
44
+ 2008-08-19
45
+ * RJ Experimental: Handle property elements. NOTE: signature change for process-assert,
46
+ process-report and process-rule to add property.
47
+ 2008-08-11
48
+ * RJ Fix attribute/@select which saxon allows in XSLT 1
49
+ 2008-08-07
50
+ * RJ Add output-encoding attribute to specify final encoding to use
51
+ * Alter allow-foreign functionality so that Schematron span, emph and dir elements make
52
+ it to the output, for better formatting and because span can be used to mark up
53
+ semantically interesting information embedded in diagnostics, which reduces the
54
+ need to extend SVRL itself
55
+ * Diagnostic-reference had an invalid attribute @id that duplicated @diagnostic: removed
56
+ 2008-08-06
57
+ * RJ Fix invalid output: svrl:diagnostic-reference is not contained in an svrl:text
58
+ * Output comment to SVRL file giving filename if available (from command-line parameter)
59
+ 2008-08-04
60
+ * RJ move sch: prefix to schold: prefix to prevent confusion (we want people to
61
+ be able to switch from old namespace to new namespace without changing the
62
+ sch: prefix, so it is better to keep that prefix completely out of the XSLT)
63
+ * Extra signature fixes (PH)
64
+ 2008-08-03
65
+ * Repair missing class parameter on process-p
66
+ 2008-07-31
67
+ * Update skeleton names
68
+ 2007-04-03
69
+ * Add option generate-fired-rule (RG)
70
+ 2007-02-07
71
+ * Prefer true|false for parameters. But allow yes|no on some old for compatability
72
+ * DP Diagnostics output to svrl:text. Diagnosis put out after assertion text.
73
+ * Removed non-SVRL elements and attributes: better handled as an extra layer that invokes this one
74
+ * Add more formal parameters
75
+ * Correct confusion between $schemaVersion and $queryBinding
76
+ * Indent
77
+ * Validate against RNC schemas for XSLT 1 and 2 (with regex tests removed)
78
+ * Validate output with UniversalTest.sch against RNC schema for ISO SVRL
79
+
80
+ 2007-02-01
81
+ * DP. Update formal parameters of overriding named templates to handle more attributes.
82
+ * DP. Refactor handling of rich and linkable parameters to a named template.
83
+
84
+ 2007-01-22
85
+ * DP change svrl:ns to svrl:ns-in-attribute-value
86
+ * Change default when no queryBinding from "unknown" to "xslt"
87
+
88
+ 2007-01-18:
89
+ * Improve documentation
90
+ * KH Add command-line options to generate paths or not
91
+ * Use axsl:attribute rather than xsl:attribute to shut XSLT2 up
92
+ * Add extra command-line options to pass to the iso_schematron_skeleton
93
+
94
+ 2006-12-01: iso_svrl.xsl Rick Jelliffe,
95
+ * update namespace,
96
+ * update phase handling,
97
+ * add flag param to process-assert and process-report & @ flag on output
98
+
99
+ 2001: Conformance1-5.xsl Rick Jelliffe,
100
+ * Created, using the skeleton code contributed by Oliver Becker
101
+ -->
102
+ <!--
103
+ Derived from Conformance1-5.xsl.
104
+
105
+ Copyright (c) 2001-2010 Rick Jelliffe and Academia Sinica Computing Center, Taiwan
106
+
107
+ This software is provided 'as-is', without any express or implied warranty.
108
+ In no event will the authors be held liable for any damages arising from
109
+ the use of this software.
110
+
111
+ Permission is granted to anyone to use this software for any purpose,
112
+ including commercial applications, and to alter it and redistribute it freely,
113
+ subject to the following restrictions:
114
+
115
+ 1. The origin of this software must not be misrepresented; you must not claim
116
+ that you wrote the original software. If you use this software in a product,
117
+ an acknowledgment in the product documentation would be appreciated but is
118
+ not required.
119
+
120
+ 2. Altered source versions must be plainly marked as such, and must not be
121
+ misrepresented as being the original software.
122
+
123
+ 3. This notice may not be removed or altered from any source distribution.
124
+ -->
125
+
126
+ <!-- Ideas nabbed from schematrons by Francis N., Miloslav N. and David C. -->
127
+
128
+ <!-- The command-line parameters are:
129
+ phase NMTOKEN | "#ALL" (default) Select the phase for validation
130
+ allow-foreign "true" | "false" (default) Pass non-Schematron elements and rich markup to the generated stylesheet
131
+ diagnose= true | false|yes|no Add the diagnostics to the assertion test in reports (yes|no are obsolete)
132
+ property= true | false Experimental: Add properties to the assertion test in reports
133
+ generate-paths=true|false|yes|no generate the @location attribute with XPaths (yes|no are obsolete)
134
+ sch.exslt.imports semi-colon delimited string of filenames for some EXSLT implementations
135
+ optimize "visit-no-attributes" Use only when the schema has no attributes as the context nodes
136
+ generate-fired-rule "true"(default) | "false" Generate fired-rule elements
137
+ terminate= yes | no | true | false | assert Terminate on the first failed assertion or successful report
138
+ Note: whether any output at all is generated depends on the XSLT implementation.
139
+ -->
140
+
141
+ <xsl:stylesheet
142
+ version="1.0"
143
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
144
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
145
+ xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias"
146
+ xmlns:schold="http://www.ascc.net/xml/schematron"
147
+ xmlns:iso="http://purl.oclc.org/dsdl/schematron"
148
+ xmlns:svrl="http://purl.oclc.org/dsdl/svrl"
149
+
150
+ >
151
+
152
+ <!-- Select the import statement and adjust the path as
153
+ necessary for your system.
154
+ -->
155
+ <xsl:import href="iso_schematron_skeleton_for_saxon.xsl"/>
156
+
157
+ <!--
158
+ <xsl:import href="iso_schematron_skeleton_for_xslt1.xsl"/>
159
+
160
+ <xsl:import href="iso_schematron_skeleton.xsl"/>
161
+ <xsl:import href="skeleton1-5.xsl"/>
162
+ <xsl:import href="skeleton1-6.xsl"/>
163
+ -->
164
+
165
+ <xsl:param name="diagnose">true</xsl:param>
166
+ <xsl:param name="property">true</xsl:param>
167
+ <xsl:param name="phase">
168
+ <xsl:choose>
169
+ <!-- Handle Schematron 1.5 and 1.6 phases -->
170
+ <xsl:when test="//schold:schema/@defaultPhase">
171
+ <xsl:value-of select="//schold:schema/@defaultPhase"/>
172
+ </xsl:when>
173
+ <!-- Handle ISO Schematron phases -->
174
+ <xsl:when test="//iso:schema/@defaultPhase">
175
+ <xsl:value-of select="//iso:schema/@defaultPhase"/>
176
+ </xsl:when>
177
+ <xsl:otherwise>#ALL</xsl:otherwise>
178
+ </xsl:choose>
179
+ </xsl:param>
180
+ <xsl:param name="allow-foreign">false</xsl:param>
181
+ <xsl:param name="generate-paths">true</xsl:param>
182
+ <xsl:param name="generate-fired-rule">true</xsl:param>
183
+ <xsl:param name="optimize" />
184
+ <!-- e.g. saxon file.xml file.xsl "sch.exslt.imports=.../string.xsl;.../math.xsl" -->
185
+ <xsl:param name="sch.exslt.imports" />
186
+
187
+ <xsl:param name="terminate" >false</xsl:param>
188
+
189
+ <!-- Set the language code for messages -->
190
+ <xsl:param name="langCode">default</xsl:param>
191
+
192
+ <xsl:param name="output-encoding"/>
193
+
194
+ <!-- Set the default for schematron-select-full-path, i.e. the notation for svrl's @location-->
195
+ <xsl:param name="full-path-notation">1</xsl:param>
196
+
197
+
198
+
199
+ <!-- Experimental: If this file called, then must be generating svrl -->
200
+ <xsl:variable name="svrlTest" select="true()" />
201
+
202
+
203
+
204
+ <!-- ================================================================ -->
205
+
206
+ <xsl:template name="process-prolog">
207
+ <axsl:output method="xml" omit-xml-declaration="no" standalone="yes"
208
+ indent="yes">
209
+ <xsl:if test=" string-length($output-encoding) &gt; 0">
210
+ <xsl:attribute name="encoding"><xsl:value-of select=" $output-encoding" /></xsl:attribute>
211
+ </xsl:if>
212
+ </axsl:output>
213
+
214
+ </xsl:template>
215
+
216
+ <!-- Overrides skeleton.xsl -->
217
+ <xsl:template name="process-root">
218
+ <xsl:param name="title"/>
219
+ <xsl:param name="contents" />
220
+ <xsl:param name="queryBinding" >xslt1</xsl:param>
221
+ <xsl:param name="schemaVersion" />
222
+ <xsl:param name="id" />
223
+ <xsl:param name="version"/>
224
+ <!-- "Rich" parameters -->
225
+ <xsl:param name="fpi" />
226
+ <xsl:param name="icon" />
227
+ <xsl:param name="lang" />
228
+ <xsl:param name="see" />
229
+ <xsl:param name="space" />
230
+
231
+ <svrl:schematron-output title="{$title}" schemaVersion="{$schemaVersion}" >
232
+ <xsl:if test=" string-length( normalize-space( $phase )) &gt; 0 and
233
+ not( normalize-space( $phase ) = '#ALL') ">
234
+ <axsl:attribute name="phase">
235
+ <xsl:value-of select=" $phase " />
236
+ </axsl:attribute>
237
+ </xsl:if>
238
+
239
+ <axsl:comment><axsl:value-of select="$archiveDirParameter"/> &#xA0;
240
+ <axsl:value-of select="$archiveNameParameter"/> &#xA0;
241
+ <axsl:value-of select="$fileNameParameter"/> &#xA0;
242
+ <axsl:value-of select="$fileDirParameter"/></axsl:comment>
243
+
244
+
245
+ <xsl:apply-templates mode="do-schema-p" />
246
+ <xsl:copy-of select="$contents" />
247
+ </svrl:schematron-output>
248
+ </xsl:template>
249
+
250
+
251
+ <xsl:template name="process-assert">
252
+ <xsl:param name="test"/>
253
+ <xsl:param name="diagnostics" />
254
+ <xsl:param name="properties" />
255
+ <xsl:param name="id" />
256
+ <xsl:param name="flag" />
257
+ <!-- "Linkable" parameters -->
258
+ <xsl:param name="role"/>
259
+ <xsl:param name="subject"/>
260
+ <!-- "Rich" parameters -->
261
+ <xsl:param name="fpi" />
262
+ <xsl:param name="icon" />
263
+ <xsl:param name="lang" />
264
+ <xsl:param name="see" />
265
+ <xsl:param name="space" />
266
+ <svrl:failed-assert test="{$test}" >
267
+ <xsl:if test="string-length( $id ) &gt; 0">
268
+ <axsl:attribute name="id">
269
+ <xsl:value-of select=" $id " />
270
+ </axsl:attribute>
271
+ </xsl:if>
272
+ <xsl:if test=" string-length( $flag ) &gt; 0">
273
+ <axsl:attribute name="flag">
274
+ <xsl:value-of select=" $flag " />
275
+ </axsl:attribute>
276
+ </xsl:if>
277
+ <!-- Process rich attributes. -->
278
+ <xsl:call-template name="richParms">
279
+ <xsl:with-param name="fpi" select="$fpi"/>
280
+ <xsl:with-param name="icon" select="$icon"/>
281
+ <xsl:with-param name="lang" select="$lang"/>
282
+ <xsl:with-param name="see" select="$see" />
283
+ <xsl:with-param name="space" select="$space" />
284
+ </xsl:call-template>
285
+ <xsl:call-template name='linkableParms'>
286
+ <xsl:with-param name="role" select="$role" />
287
+ <xsl:with-param name="subject" select="$subject"/>
288
+ </xsl:call-template>
289
+ <xsl:if test=" $generate-paths = 'true' or $generate-paths= 'yes' ">
290
+ <!-- true/false is the new way -->
291
+ <axsl:attribute name="location">
292
+ <axsl:apply-templates select="." mode="schematron-select-full-path"/>
293
+ </axsl:attribute>
294
+ </xsl:if>
295
+
296
+ <svrl:text>
297
+ <xsl:apply-templates mode="text" />
298
+
299
+ </svrl:text>
300
+ <xsl:if test="$diagnose = 'yes' or $diagnose= 'true' ">
301
+ <!-- true/false is the new way -->
302
+ <xsl:call-template name="diagnosticsSplit">
303
+ <xsl:with-param name="str" select="$diagnostics"/>
304
+ </xsl:call-template>
305
+ </xsl:if>
306
+
307
+
308
+ <xsl:if test="$property= 'yes' or $property= 'true' ">
309
+ <!-- true/false is the new way -->
310
+ <xsl:call-template name="propertiesSplit">
311
+ <xsl:with-param name="str" select="$properties"/>
312
+ </xsl:call-template>
313
+ </xsl:if>
314
+
315
+ </svrl:failed-assert>
316
+
317
+
318
+ <xsl:if test=" $terminate = 'yes' or $terminate = 'true' ">
319
+ <axsl:message terminate="yes">TERMINATING</axsl:message>
320
+ </xsl:if>
321
+ <xsl:if test=" $terminate = 'assert' ">
322
+ <axsl:message terminate="yes">TERMINATING</axsl:message>
323
+ </xsl:if>
324
+ </xsl:template>
325
+
326
+ <xsl:template name="process-report">
327
+ <xsl:param name="id"/>
328
+ <xsl:param name="test"/>
329
+ <xsl:param name="diagnostics"/>
330
+ <xsl:param name="flag" />
331
+ <xsl:param name="properties"/>
332
+ <!-- "Linkable" parameters -->
333
+ <xsl:param name="role"/>
334
+ <xsl:param name="subject"/>
335
+ <!-- "Rich" parameters -->
336
+ <xsl:param name="fpi" />
337
+ <xsl:param name="icon" />
338
+ <xsl:param name="lang" />
339
+ <xsl:param name="see" />
340
+ <xsl:param name="space" />
341
+ <svrl:successful-report test="{$test}" >
342
+ <xsl:if test=" string-length( $id ) &gt; 0">
343
+ <axsl:attribute name="id">
344
+ <xsl:value-of select=" $id " />
345
+ </axsl:attribute>
346
+ </xsl:if>
347
+ <xsl:if test=" string-length( $flag ) &gt; 0">
348
+ <axsl:attribute name="flag">
349
+ <xsl:value-of select=" $flag " />
350
+ </axsl:attribute>
351
+ </xsl:if>
352
+
353
+ <!-- Process rich attributes. -->
354
+ <xsl:call-template name="richParms">
355
+ <xsl:with-param name="fpi" select="$fpi"/>
356
+ <xsl:with-param name="icon" select="$icon"/>
357
+ <xsl:with-param name="lang" select="$lang"/>
358
+ <xsl:with-param name="see" select="$see" />
359
+ <xsl:with-param name="space" select="$space" />
360
+ </xsl:call-template>
361
+ <xsl:call-template name='linkableParms'>
362
+ <xsl:with-param name="role" select="$role" />
363
+ <xsl:with-param name="subject" select="$subject"/>
364
+ </xsl:call-template>
365
+ <xsl:if test=" $generate-paths = 'yes' or $generate-paths = 'true' ">
366
+ <!-- true/false is the new way -->
367
+ <axsl:attribute name="location">
368
+ <axsl:apply-templates select="." mode="schematron-select-full-path"/>
369
+ </axsl:attribute>
370
+ </xsl:if>
371
+
372
+ <svrl:text>
373
+ <xsl:apply-templates mode="text" />
374
+
375
+ </svrl:text>
376
+ <xsl:if test="$diagnose = 'yes' or $diagnose='true' ">
377
+ <!-- true/false is the new way -->
378
+ <xsl:call-template name="diagnosticsSplit">
379
+ <xsl:with-param name="str" select="$diagnostics"/>
380
+ </xsl:call-template>
381
+ </xsl:if>
382
+
383
+
384
+ <xsl:if test="$property = 'yes' or $property='true' ">
385
+ <!-- true/false is the new way -->
386
+ <xsl:call-template name="propertiesSplit">
387
+ <xsl:with-param name="str" select="$properties"/>
388
+ </xsl:call-template>
389
+ </xsl:if>
390
+
391
+
392
+ </svrl:successful-report>
393
+
394
+
395
+ <xsl:if test=" $terminate = 'yes' or $terminate = 'true' ">
396
+ <axsl:message terminate="yes" >TERMINATING</axsl:message>
397
+ </xsl:if>
398
+ </xsl:template>
399
+
400
+
401
+
402
+
403
+ <xsl:template name="process-diagnostic">
404
+ <xsl:param name="id"/>
405
+ <!-- Rich parameters -->
406
+ <xsl:param name="fpi" />
407
+ <xsl:param name="icon" />
408
+ <xsl:param name="lang" />
409
+ <xsl:param name="see" />
410
+ <xsl:param name="space" />
411
+ <svrl:diagnostic-reference diagnostic="{$id}" >
412
+ <!--xsl:if test="string($id)">
413
+ <xsl:attribute name="id">
414
+ <xsl:value-of select="$id"/>
415
+ </xsl:attribute>
416
+ </xsl:if-->
417
+ <xsl:call-template name="richParms">
418
+ <xsl:with-param name="fpi" select="$fpi"/>
419
+ <xsl:with-param name="icon" select="$icon"/>
420
+ <xsl:with-param name="lang" select="$lang"/>
421
+ <xsl:with-param name="see" select="$see" />
422
+ <xsl:with-param name="space" select="$space" />
423
+ </xsl:call-template>
424
+ <xsl:text>
425
+ </xsl:text>
426
+
427
+ <xsl:apply-templates mode="text"/>
428
+
429
+ </svrl:diagnostic-reference>
430
+ </xsl:template>
431
+
432
+
433
+ <!-- Overrides skeleton -->
434
+ <xsl:template name="process-dir" >
435
+ <xsl:param name="value" />
436
+ <xsl:choose>
437
+ <xsl:when test=" $allow-foreign = 'true'">
438
+ <xsl:copy-of select="."/>
439
+ </xsl:when>
440
+
441
+ <xsl:otherwise>
442
+ <!-- We generate too much whitespace rather than risking concatenation -->
443
+ <axsl:text> </axsl:text>
444
+ <xsl:apply-templates mode="inline-text"/>
445
+ <axsl:text> </axsl:text>
446
+ </xsl:otherwise>
447
+ </xsl:choose>
448
+ </xsl:template>
449
+
450
+
451
+ <!-- Overrides skeleton -->
452
+ <xsl:template name="process-emph" >
453
+ <xsl:param name="class" />
454
+ <xsl:choose>
455
+ <xsl:when test=" $allow-foreign = 'true'">
456
+ <xsl:copy-of select="."/>
457
+ </xsl:when>
458
+ <xsl:otherwise>
459
+ <!-- We generate too much whitespace rather than risking concatenation -->
460
+ <axsl:text> </axsl:text>
461
+ <xsl:apply-templates mode="inline-text"/>
462
+ <axsl:text> </axsl:text>
463
+ </xsl:otherwise>
464
+ </xsl:choose>
465
+ </xsl:template>
466
+
467
+ <xsl:template name="process-rule">
468
+ <xsl:param name="id"/>
469
+ <xsl:param name="context"/>
470
+ <xsl:param name="flag"/>
471
+ <xsl:param name="properties" />
472
+ <!-- "Linkable" parameters -->
473
+ <xsl:param name="role"/>
474
+ <xsl:param name="subject"/>
475
+ <!-- "Rich" parameters -->
476
+ <xsl:param name="fpi" />
477
+ <xsl:param name="icon" />
478
+ <xsl:param name="lang" />
479
+ <xsl:param name="see" />
480
+ <xsl:param name="space" />
481
+ <xsl:if test=" $generate-fired-rule = 'true'">
482
+ <svrl:fired-rule context="{$context}" >
483
+ <xsl:if test=" string( $id )">
484
+ <xsl:attribute name="id">
485
+ <xsl:value-of select=" $id " />
486
+ </xsl:attribute>
487
+ </xsl:if>
488
+ <xsl:if test=" string-length( $role ) &gt; 0">
489
+ <xsl:attribute name="role">
490
+ <xsl:value-of select=" $role " />
491
+ </xsl:attribute>
492
+ </xsl:if>
493
+ <!-- Process rich attributes. -->
494
+ <xsl:call-template name="richParms">
495
+ <xsl:with-param name="fpi" select="$fpi"/>
496
+ <xsl:with-param name="icon" select="$icon"/>
497
+ <xsl:with-param name="lang" select="$lang"/>
498
+ <xsl:with-param name="see" select="$see" />
499
+ <xsl:with-param name="space" select="$space" />
500
+ </xsl:call-template>
501
+
502
+
503
+ <xsl:if test="$property= 'yes' or $property= 'true' ">
504
+ <!-- true/false is the new way -->
505
+ <xsl:call-template name="propertiesSplit">
506
+ <xsl:with-param name="str" select="$properties"/>
507
+ </xsl:call-template>
508
+ </xsl:if>
509
+
510
+ </svrl:fired-rule>
511
+ </xsl:if>
512
+ </xsl:template>
513
+
514
+ <xsl:template name="process-ns">
515
+ <xsl:param name="prefix"/>
516
+ <xsl:param name="uri"/>
517
+ <svrl:ns-prefix-in-attribute-values uri="{$uri}" prefix="{$prefix}" />
518
+ </xsl:template>
519
+
520
+ <xsl:template name="process-p">
521
+ <xsl:param name="icon"/>
522
+ <xsl:param name="class"/>
523
+ <xsl:param name="id"/>
524
+ <xsl:param name="lang"/>
525
+
526
+ <svrl:text>
527
+ <xsl:apply-templates mode="text"/>
528
+ </svrl:text>
529
+ </xsl:template>
530
+
531
+ <xsl:template name="process-pattern">
532
+ <xsl:param name="name"/>
533
+ <xsl:param name="id"/>
534
+ <xsl:param name="is-a"/>
535
+
536
+ <!-- "Rich" parameters -->
537
+ <xsl:param name="fpi" />
538
+ <xsl:param name="icon" />
539
+ <xsl:param name="lang" />
540
+ <xsl:param name="see" />
541
+ <xsl:param name="space" />
542
+ <svrl:active-pattern >
543
+ <axsl:attribute name="document">
544
+ <axsl:value-of select="document-uri(/)" />
545
+ </axsl:attribute><!-- If XSLT1 remove this -->
546
+ <xsl:if test=" string( $id )">
547
+ <axsl:attribute name="id">
548
+ <xsl:value-of select=" $id " />
549
+ </axsl:attribute>
550
+ </xsl:if>
551
+ <xsl:if test=" string( $name )">
552
+ <axsl:attribute name="name">
553
+ <xsl:value-of select=" $name " />
554
+ </axsl:attribute>
555
+ </xsl:if>
556
+
557
+ <xsl:call-template name='richParms'>
558
+ <xsl:with-param name="fpi" select="$fpi"/>
559
+ <xsl:with-param name="icon" select="$icon"/>
560
+ <xsl:with-param name="lang" select="$lang"/>
561
+ <xsl:with-param name="see" select="$see" />
562
+ <xsl:with-param name="space" select="$space" />
563
+ </xsl:call-template>
564
+
565
+ <!-- ?? report that this screws up iso:title processing -->
566
+ <xsl:apply-templates mode="do-pattern-p"/>
567
+ <!-- ?? Seems that this apply-templates is never triggered DP -->
568
+ <axsl:apply-templates />
569
+ </svrl:active-pattern>
570
+ </xsl:template>
571
+
572
+ <!-- Overrides skeleton -->
573
+ <xsl:template name="process-message" >
574
+ <xsl:param name="pattern"/>
575
+ <xsl:param name="role"/>
576
+ </xsl:template>
577
+
578
+
579
+ <!-- Overrides skeleton -->
580
+ <xsl:template name="process-span" >
581
+ <xsl:param name="class" />
582
+ <xsl:choose>
583
+ <xsl:when test=" $allow-foreign = 'true'">
584
+ <xsl:copy-of select="."/>
585
+ </xsl:when>
586
+ <xsl:otherwise>
587
+ <!-- We generate too much whitespace rather than risking concatenation -->
588
+ <axsl:text> </axsl:text>
589
+ <xsl:apply-templates mode="inline-text"/>
590
+ <axsl:text> </axsl:text>
591
+ </xsl:otherwise>
592
+ </xsl:choose>
593
+ </xsl:template>
594
+
595
+ <!-- =========================================================================== -->
596
+ <!-- processing rich parameters. -->
597
+ <xsl:template name='richParms'>
598
+ <!-- "Rich" parameters -->
599
+ <xsl:param name="fpi" />
600
+ <xsl:param name="icon" />
601
+ <xsl:param name="lang" />
602
+ <xsl:param name="see" />
603
+ <xsl:param name="space" />
604
+ <!-- Process rich attributes. -->
605
+ <xsl:if test=" $allow-foreign = 'true'">
606
+ <xsl:if test="string($fpi)">
607
+ <axsl:attribute name="fpi">
608
+ <xsl:value-of select="$fpi "/>
609
+ </axsl:attribute>
610
+ </xsl:if>
611
+ <xsl:if test="string($icon)">
612
+ <axsl:attribute name="icon">
613
+ <xsl:value-of select="$icon"/>
614
+ </axsl:attribute>
615
+ </xsl:if>
616
+ <xsl:if test="string($see)">
617
+ <axsl:attribute name="see">
618
+ <xsl:value-of select="$see" />
619
+ </axsl:attribute>
620
+ </xsl:if>
621
+ </xsl:if>
622
+ <xsl:if test="string($space)">
623
+ <axsl:attribute name="xml:space">
624
+ <xsl:value-of select="$space"/>
625
+ </axsl:attribute>
626
+ </xsl:if>
627
+ <xsl:if test="string($lang)">
628
+ <axsl:attribute name="xml:lang">
629
+ <xsl:value-of select="$lang"/>
630
+ </axsl:attribute>
631
+ </xsl:if>
632
+ </xsl:template>
633
+
634
+ <!-- processing linkable parameters. -->
635
+ <xsl:template name='linkableParms'>
636
+ <xsl:param name="role"/>
637
+ <xsl:param name="subject"/>
638
+
639
+ <!-- ISO SVRL has a role attribute to match the Schematron role attribute -->
640
+ <xsl:if test=" string($role )">
641
+ <axsl:attribute name="role">
642
+ <xsl:value-of select=" $role " />
643
+ </axsl:attribute>
644
+ </xsl:if>
645
+ <!-- ISO SVRL does not have a subject attribute to match the Schematron subject attribute.
646
+ Instead, the Schematron subject attribute is folded into the location attribute -->
647
+ </xsl:template>
648
+
649
+
650
+
651
+ <!-- ===================================================== -->
652
+ <!-- Extension API: -->
653
+ <!-- This allows the transmission of extra attributes on -->
654
+ <!-- rules, asserts, reports, diagnostics. -->
655
+ <!-- ===================================================== -->
656
+
657
+
658
+ <!-- Overrides skeleton EXPERIMENTAL -->
659
+ <!-- The $contents is for static contents, the $value is for dynamic contents -->
660
+ <xsl:template name="process-property">
661
+ <xsl:param name="id"/>
662
+ <xsl:param name="name"/>
663
+ <xsl:param name="value"/>
664
+ <xsl:param name="contents"/>
665
+
666
+ <svrl:property id="{$id}" >
667
+ <xsl:if test="$name">
668
+ <xsl:attribute name="name"><xsl:value-of select="$name"/></xsl:attribute>
669
+ </xsl:if>
670
+
671
+ <xsl:if test="$value">
672
+ <xsl:attribute name="value"><xsl:value-of select="$value"/></xsl:attribute>
673
+ </xsl:if>
674
+
675
+ <xsl:if test="$contents">
676
+ <xsl:copy-of select="$contents"/>
677
+ </xsl:if>
678
+
679
+ </svrl:property>
680
+ </xsl:template>
681
+
682
+
683
+ </xsl:stylesheet>
684
+