aboutsummaryrefslogtreecommitdiffstats
path: root/lib/xmerl/test/xmlconformance.msxsl
blob: f33e647d25dd2fcfe4d0d623e62add522b88e53a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
<?xml version='1.0'?>
<!--
<<<<<<< conformance.msxsl
    Original version copyright 1999 by Sun Microsystems, Inc.
    All Rights Reserved.
    Modifications copyright 1999 by OASIS.
=======
    XSL IE5 Stylesheet for documenting XML conformance tests.
    Tested against IE5 5.00.2014.0216

    1999-06-05 20:10

    XSL 12/16/1998 Stylesheet for documenting XML conformance tests.

    This expects to be run on a document matching the DTD that Sun
    defined and OASIS modified for merging collections of 
    self-descriptive XML tests.

    Since all those collections will have (by design) the same test
    architecture, this includes boilerplate describing that design,
    to be used by all test documentation.

    ISSUES:
	- Sorting is a bit odd; section numbers can are like "3.3.3"
	  rather than straight numbers, so numeric sort can't work,
	  and yet neither does text sort (2.12 should be after 2.2).
	
-->

<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/TR/WD-xsl"
	xmlns="http://www.w3.org/TR/WD-xhtml"
	indent-result="yes"
	>

<!-- default behaviour - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<xsl:template><xsl:apply-templates/></xsl:template>
<xsl:template match="textnode()"><xsl:value-of/></xsl:template>

<!-- selective behaviour - - - - - - - - - - - - - - - - - - - - - - - - -->


    <!-- ROOT:  write an HTML wrapper -->
    <xsl:template match="/">
      <xsl:apply-templates select="TESTSUITE"/>
    </xsl:template>
    
    <xsl:template match="TESTSUITE">
	<!-- XHTML namespace -->
	<html><head>
	    <xsl:comment>Generated by an XSL stylesheet.</xsl:comment>
	    <title> XML Conformance Tests </title>
	    <meta http-equiv="Content-Type"
		content="text/html;charset=utf-8"/>
	    <style>
		<xsl:comment>
		    BODY {
			font-family:	Lucida, Helvetica, Univers, sans-serif;
		    }
		    H1, H2, H3, H4 {
			text-align:	left;
			color:		#0066CC;
		    }
		</xsl:comment>
	    </style>
	    <style>
		<xsl:comment>
		    a:hover { 
			color:		white;
			background-color: blue;
		    }
		</xsl:comment>
	    </style>
	</head><body bgcolor='#ffffff'>
	    <center>
	    <table border="4" width="90%">
	    <tr >
	    <td>
	    <table>
	    <tr >
	    <td width="40%"><img src="files/a_oasis-logo.gif" width="350" height="125"/></td>
	    <td width="30%"/>
	    <td width="40%" align="right"><img src="files/top3.jpe" width="400" height="125"/></td>
            </tr>
	    </table>
	    <center>
	    <table>
	    <tr>
	    <td ><b><font size="+2">A Joint Development Effort</font></b></td>
	    </tr>
	    </table>
            </center>
	    </td>
	    </tr>
	    </table>
	    </center>
	    <p/>

	    <p/>
	    <h4>OASIS XML Conformance Subcommittee<br/>XML 1.0 Test Suite, Second Edition<br/>Working Draft<br/>15 March 2001</h4>
            <dl>
	    <dt><b>This version:</b></dt>
	    <dd><ul>
	       <li><a href="http://www.oasis-open.org/committees/xml-conformance/suite-v1se/xmlconf-20010315.htm">
		   http://www.oasis-open.org/committees/xml-conformance/suite-v1se/xmlconf-20010315.htm</a>
		   (<a href="http://www.oasis-open.org/committees/xml-conformance/suite-v1se/xmlconf-20010315.xml">XML</a>)
	       </li>
	    </ul>
	    </dd>
	    <p/>
	    <dt><b>Current Version:</b></dt>
	    <dd>
	    <ul>
	       <li><a href="http://www.oasis-open.org/committees/xml-conformance/suite-v1se/xmlconf.xml">
		   http://www.oasis-open.org/committees/xml-conformance/suite-v1se/xmlconf.xml</a></li>
            </ul>
            </dd>
	    <p/>
	    <dt><b>Previous Version:</b></dt>
	    <dd>
	    <ul>
	       <li><a href="http://www.oasis-open.org/committees/xml-conformance/suite-v1/xmlconf-19990712.xml">
		   http://www.oasis-open.org/committees/xml-conformance/suite-v1/xmlconf-19990712.xml</a></li>
            </ul>
            </dd>
	    <p/>
	    <dt><b>Test Archive:</b></dt>
	    <dd><ul>
	    <li><a href="http://www.oasis-open.org/committees/xml-conformance/suite-v1se/xmlconf-20010315.tar.gz">http://www.oasis-open.org/committees/xml-conformance/suite-v1se/xmlconf-20010315.tar.gz</a>
	    </li>
	    </ul></dd>
	    <p/>
	    <dt><b>OASIS XML Conformance Technical Committee:</b></dt> 	
	    <dd><ul><li><a href="http://www.oasis-open.org/committees/xml-conformance/">http://www.oasis-open.org/committees/xml-conformance/</a>
	    </li></ul></dd>
	    <p/>
	    <dt><b>Comments:</b></dt> 	
	    <dd><ul><li>Mary Brady, NIST <a href="mailto:[email protected]">&lt;[email protected]&gt;</a>
	    </li></ul></dd>
	    <p/>
	    </dl>
	    <hr/>

	    <a name="contents"/>
            <h2>Table of Contents</h2>
	    <ol >
		<li><a href="#intro">Introduction</a></li>
		<li><a href="#matrix">Test Matrix</a></li> 
		<ol >
		    <li ><a href="#binary">Binary Tests</a></li>
		    <li><a href="#output">Output Tests</a></li>
		</ol>
		<li><a href="#listings">Test Case Descriptions</a></li>
		<ol >
		    <li><a href="#valid">Valid Documents</a></li>
		    <li><a href="#invalid">Invalid Documents</a></li>
		    <li><a href="#not-wf">Not-WF Documents</a></li>
		    <li><a href="#error">Optional Errors</a></li>
		</ol>
                <li><a href="#contrib">Contributors</a></li>
	    </ol>
	    <a name="intro"/>
	    <h2>1. Introduction </h2>
	    <p> The <i>OASIS</i> XML Conformance Subcommittee is concerned with 
	    improving the quality of XML processors.  The tests described in this
            document provide a set of metrics to determine how well a 
            particular implementation conforms to the 
            <a href="http://www.w3.org/TR/REC-xml">W3C XML 1.0 (Second Edition) Recommendation </a>.
	    The XML Conformance Test Suite is intended
	    to complement the W3C XML 1.0 (Second Edition) Recommendation.  All interpretations of
	    this Recommendation are subject to confirmation by the 
	    <a href="http://www.w3.org/XML/Activity.html">W3C XML Coordination Group</a>.
	    </p>
	    <p>
	    Conformance tests can be used by developers, content creators, and 
            users alike to increase their level of confidence in product quality. In
	    circumstances where interoperability is necessary, these tests can also
	    be used to determine that differing implementations support the same set
            of features. </p>
           
            <p>This report provides supporting documentation for all of the tests
            contributed by members of the <i>OASIS</i> XML Conformance Subcommittee. 
	    Sources from which these tests have been collected
	    include: <em>
		<xsl:for-each select="./TESTCASES">
		    <xsl:value-of select="@PROFILE"/>;
		</xsl:for-each>
	    </em>.  Although the tests came from a variety of sources, the actual test
	    descriptions and references back to the recommendation were in many instances
	    added by members of this subcommittee.  It is anticipated that this report 
            will supplement the actual tests, which are available from 
            <a href="http://www.oasis-open.org/committees/xml-conformance/xml-test-suite.html">
            http://www.oasis-open.org/committees/xml-conformance/xml-test-suite.html</a>.</p>  

	    <p>Comments/suggestions should be 
            forwarded to the XML Conformance Subcommittee Chair, Mary Brady <a href="mailto:[email protected]">&lt;[email protected]&gt;</a>.</p> 


	    <a name="matrix"/>
	    <h2>2. Test Matrix </h2>

	    <p> Two basic types of test are presented here.  These are
	    respectively <em><a href="#binary">Binary Tests</a></em>
	    and <em><a href="#output">Output Tests</a></em>. </p>

	    <a name="binary"/>
	    <h3>2.1  Binary Tests </h3>

	    <p> <em>Binary</em> conformance tests are documents which
	    are grouped into one of four categories.  Given a document
	    in a given category, each kind of XML parser must treat it
	    consistently and either accept it (a <em>positive test</em>)
	    or reject it (a <em>negative test</em>).  It is in that sense
	    that the tests are termed "binary". The XML 1.0 (Second Edition) Recommendation
	    talks in terms of two types of XML processor:
	    <em>validating</em> ones, and <em>nonvalidating</em> ones.
	    There are two differences between these types of processors: </p>

	    <ol>
		<li> Validating processors check special productions that
		nonvalidating parsers don't, called <em>validity
		constraints</em>.  (Both must check a basic set of productions,
		requiring XML documents to be <em>well formed</em>.) </li>

		<li> Nonvalidating processors are permitted to not
		include <em>external entities</em>, such as files with
		text.  Accordingly, they may not report errors which
		would have been detected had those entities been read.</li>
	    </ol>

	    <p> There are two types of such entity, <em>parameter
	    entities</em> holding definitions which affect validation
	    and other processing; and <em>general entities</em> which
	    hold marked up text.  It will be appreciated that there are
	    then five kinds of XML processor:  validating processors,
	    and four kinds of nonvalidating processor based on the
	    combinations of external entity which they include.</p>

	    <center>
	    <table border="1" bgcolor="#ffffff" cellpadding="4">

	    <caption>
	    <b>Basic XML Parsing Test Matrix</b><br/>
	    Test Document Type v. Parser Type
	    </caption>

	    <tr bgcolor="#ffffcc">
		<th widthH="5%" rowspan="2">&#160;</th>
		<th widthH="20%" colspan="2">Nonvalidating</th>
		<th widthH="5%" rowspan="2">Validating</th>
	    </tr>

	    <tr bgcolor="#ffffcc">
		<th>External Entities<br/>Ignored (3 cases)</th>
		<th>External Entities<br/>Read</th>
	    </tr>

	    <tr>
		<th bgcolor="#ffffcc">Valid Documents</th>
		<td align="center"><b>accept</b></td>
		<td align="center"><b>accept</b></td>
		<td align="center"><b>accept</b></td>
	    </tr>

	    <tr>
		<th bgcolor="#ffffcc">Invalid Documents</th>
		<td align="center"><b>accept</b></td>
		<td align="center"><b>accept</b></td>
		<td align="center">reject</td>
	    </tr>

	    <tr>
		<th bgcolor="#ffffcc">Non-WF Documents</th>
		<td align="center">reject</td>
		<td align="center">reject</td>
		<td align="center">reject</td>
	    </tr>

	    <tr>
		<th bgcolor="#ffffcc">WF Errors tied<br/>
			to External Entity</th>
		<td align="center"><b>accept</b><br/>(varies)</td>
		<td align="center">reject</td>
		<td align="center">reject</td>
	    </tr>

	    <tr>
		<th bgcolor="#ffffcc">Documents with<br/> Optional Errors</th>
		<td align="center">(not specified)</td>
		<td align="center">(not specified)</td>
		<td align="center">(not specified)</td>
	    </tr>

	    </table>
	    </center>

	    <p> At this time, the XML community primarily uses parsers
	    which are in the rightmost two columns of this table, calling
	    them <em>Well Formed XML Parsers</em> (or "WF Parsers") and
	    <em>Validating XML Parsers</em>.   A second test matrix
	    could be defined to address the variations in the types of
	    of XML processor which do not read all external entities.
	    That additional matrix is not provided here at this time. </p>


	    <a name="output"/>
	    <h3>2.2  Output Tests</h3>

	    <p> The XML 1.0 (Second Edition) Recommendation places a number of requirements
	    on XML processors, to ensure that they report information to
	    applications as needed.  Such requirements are testable.
	    Validating processors are required to report slightly more
	    information than nonvalidating ones, so some tests will
	    require separate output files.  Some of the information that
	    must be reported will not be reportable without reading all
	    the external entities in a particular test.  Many of the tests for
	    valid documents are paired with an output file to ensure that 
	    the XML processor provides the correct information.  </p>

	    <p>The output of these tests is provided in two forms, as
	    described in <a href="sun/cxml.html">SUN Microsystems XML
	    Canonical Forms</a>.  At present, the <em>James Clark</em>
	    collection provides corresponding output in <em>First XML
	    Canonical Form</em>, and the <em>SUN Microsystems</em>
 	    collection provides corresponding output in <em>Second XML
	    Canonical Form</em>.  When the <a href="http://www.w3.org/XML/">
	    W3C XML Group </a>finalizes its work on Canonical XML, these 
	    output files will be updated.
            </p>

	    <a name="listings"/>
	    <h2>3.  Test Case Descriptions</h2>

	    <p> This section of this report contains descriptions of test
	    cases, each of which fits into the categories noted above.
	    Each test case includes a document of one of the types in the
	    binary test matrix above (e.g. valid or invalid documents).
	    </p>

	    <p> In some cases, an <a href="#output">output file </a>, as 
	    described in Section 2.2, will also be associated with
	    a valid document, which is used for output testing.  If such
	    a file exists, it will be noted at the end of the description
	    of the input document.  </p>

	    <p> The description for each test case is presented as a two
	    part table.  The right part describes what the test does.
	    This description is intended to have enough detail to evaluate
	    diagnostic messages.  The left part includes: <ul>

		<li> An entry describing the <em>Sections and/or Rules</em>
		from the <a href="http://www.w3.org/TR/2000/REC-xml-20001006">
		XML 1.0 (Second Edition) Recommendation</a> which this case excercises.</li>
		
		<li> The unique <em>Test ID</em> within a given <em>Collection</em>
	        for this test. </li>

		<li> The <em>Collection</em> from which this test originated.
		Given the <em>Test ID</em> and the <em>Collection</em>, each
		test can be uniquely identified. </li>
		
		<li> Some tests may have a field identifying the kinds of
		external <em>Entities</em> a nonvalidating processor must
		include (parameter, general, or both) to be able to
		detect any errors in that test case. </li>

	    </ul></p>

	    <p><em>Note that the output format of this report is subject
	    to change.  Also, since XSL does not currently support the
	    type of sorting rule necessary to make section numbers like
	    2.12 appear after 2.2, the ordering is not quite what is
	    desired.</em></p>

	    <a name="valid"/>
	    <h3>3.1  Valid XML Documents</h3>

	    <p> All conforming <em> XML 1.0 Processors </em> are
	    <b>required</b> to accept valid documents, reporting no
	    errors.  In this section of this test report are found
	    descriptions of test cases which fit into this category. </p>

		<xsl:apply-templates select=".// TEST [ @TYPE = 'valid' ]" 
		                     order-by="@SECTIONS"/>

	    <a name="invalid"/>
	    <h3>3.2  Invalid XML Documents</h3>

	    <p> All conforming XML 1.0 <em> Validating Processors </em>
	    are <b>required</b> to report recoverable errors in the case
	    of documents which are <em>Invalid</em>.  Such errors are
	    violations of some <em>validity constraint (VC)</em>. </p>

	    <p> If a validating processor does not report an error when
	    given one of these test cases, or if the error reported is
	    a fatal error, it is not conformant.  If the error reported
	    does not correspond to the problem listed in this test
	    description, that could also be a conformance problem; it
	    might instead be a faulty diagnostic. </p>

	    <p> All conforming XML 1.0 <em> Nonvalidating Processors </em>
	    should accept these documents, reporting no errors. </p>

		<xsl:apply-templates select=".//TEST[@TYPE='invalid']"
		                     order-by="@SECTIONS"/>

	    <a name="not-wf"/>
	    <h3>3.3  Documents that are Not Well Formed</h3>

	    <p> All conforming XML 1.0 Processors are <b>required</b> to
	    report fatal errors in the case of documents which are not
	    <em>Well Formed</em>.  Such errors are basically of two types:
	    <em>(a)</em> the document violates the XML grammar; or else
	    <em>(b)</em> it violates a <em>well formedness constraint
	    (WFC)</em>.  There is a single <em>exception to that
	    requirement</em>:  nonvalidating processors which do not read
	    certain types of external entities are not required to detect
	    (and hence report) these errors. </p>

	    <p> If a processor does not report a fatal error when given
	    one of these test cases, it is not conformant.  If the error
	    reported does not correspond to the problem listed in this
	    test description, that could also be a conformance problem;
	    it might instead be a faulty diagnostic. </p>

		<xsl:apply-templates select=".// TEST [ @TYPE = 'not-wf' ]" 
		                     order-by="@SECTIONS"/>

	    <a name="error"/>
	    <h3>3.4  XML Documents with Optional Errors</h3>

	    <p> Conforming XML 1.0 Processors are permitted to ignore
	    certain errors, or to report them at user option.  In this
	    section of this test report are found descriptions of 
	    test cases which fit into this category. </p>

	    <p> Processor behavior on such test cases does not affect
	    conformance to the XML 1.0 (Second Edition) Recommendation, except as noted. </p>

		<xsl:apply-templates select=".//TEST[@TYPE='error']" 
		                     order-by="@SECTIONS"/>

	    <a name="contrib"/>
	    <h3>4.  Contributors (Non-normative)</h3>

	    <p> A team of volunteer members have participated in the
	    development of this work.  Contributions have come from:
	    </p>
	    <ul>
	    <li>Murry Altheim, Sun Microsystems</li>
	    <li>Mary Brady, NIST</li>
	    <li>Tim Boland, NIST</li>
	    <li>David Brownell, Sun Microsystems</li>
	    <li>James Clark</li>
	    <li>Karin Donker, IBM</li>
	    <li>Irina Golfman, Inera Incorporated</li>
	    <li>Tony Graham, Mulberry Technologies</li>
	    <li>G. Ken Holman, Crane Softwrights Ltd</li>
	    <li>Alex Milowski, Veo Systems, Inc</li>
	    <li>Makota Murata, Fuji Xerox</li>
	    <li>Miles O'Reilly, Microstar Software, Ltd</li>
	    <li>Matt Timmermans, Microstar Software, Ltd</li>
	    <li>Richard Rivello, NIST</li>
	    <li>Lynne Rosenthal, NIST</li>
	    <li>Brian Schellar, Chrystal Software</li>
	    <li>Bill Smith, Sun Microsystems</li>
	    <li>Trevor Veary, Software AG</li>
	    <li>Eric Ye, IBM</li>
	    </ul>
    <p>End</p>

    </body></html>
    </xsl:template>

    <xsl:template match="TEST">
      <table width="100%">
       <tr valign="top">
	    <td width='40%'><table bgcolor='#eeeeff'
		    border='1' width='100%' height="100%">
		<tr>
		    <td width='50%'><b>Sections [Rules]:</b></td>
		    <td bgcolor='#ffffcc'>
			    <xsl:value-of select="@SECTIONS"/></td>
		</tr>
		<tr valign="top">
		    <td width='50%'><b>Test ID:</b></td>
		    <td bgcolor='#ffffcc'>
			    <xsl:value-of select="@ID"/></td>
		</tr>
		<xsl:if test=".[not ( @ENTITIES = 'none')
			and ( @TYPE = 'not-wf' )]">
		    <tr valign="top">
			<td width='50%'><b>Entities:</b></td>
			<td bgcolor='#ffffcc'><font color='blue'>
				<xsl:value-of select="@ENTITIES"/>
				</font></td>
		    </tr>
		</xsl:if>
		<xsl:if test="../@PROFILE">
          <tr valign="top">
			<td width='50%'><b>Collection:</b></td>
			<td bgcolor='#ffffcc'>
				<xsl:value-of select="../@PROFILE"/>
				</td>
          </tr>
        </xsl:if>
	    </table></td>
	    <td bgcolor='#ccffff'>
		<p><xsl:apply-templates/></p>
		<xsl:if test="@OUTPUT | @OUTPUT3">
		    <p>There is an output test associated with this
		    input file.</p>
		</xsl:if>
	    </td>
	   </tr>
	  </table>
    </xsl:template>

    <!-- XT takes 'B|EM' and xsl:copy, IE5b2 doesn't -->
    <xsl:template match="EM">
	<em><xsl:apply-templates/></em>
    </xsl:template>
    <xsl:template match="B">
	<b><xsl:apply-templates/></b>
    </xsl:template>
</xsl:stylesheet>