OLD | NEW |
| (Empty) |
1 <?xml version="1.0"?> | |
2 <!-- | |
3 /* | |
4 * The contents of this file are subject to the Mozilla Public | |
5 * License Version 1.1 (the "License"); you may not use this file | |
6 * except in compliance with the License. You may obtain a copy of | |
7 * the License at http://www.mozilla.org/MPL/ | |
8 * | |
9 * Software distributed under the License is distributed on an "AS | |
10 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | |
11 * implied. See the License for the specific language governing | |
12 * rights and limitations under the License. | |
13 * | |
14 * The Original Code is XSL:P XSLT processor. | |
15 * | |
16 * The Initial Developer of the Original Code is Keith Visco. | |
17 * Portions created by Keith Visco (C) 1999 Keith Visco. | |
18 * All Rights Reserved.. | |
19 * | |
20 * Contributor(s): | |
21 * Keith Visco, kvisco@ziplink.net | |
22 * - original author. | |
23 * | |
24 */ | |
25 --> | |
26 | |
27 <!-- | |
28 This is a test stylesheet used for testing the XSL processor | |
29 --> | |
30 | |
31 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | |
32 | |
33 <!-- set the output properties --> | |
34 <xsl:output method="html"/> | |
35 | |
36 <!-- AttributeSet --> | |
37 <xsl:attribute-set name="style1"> | |
38 <xsl:attribute name="COLOR">blue</xsl:attribute> | |
39 <xsl:attribute name="SIZE">+0</xsl:attribute> | |
40 </xsl:attribute-set> | |
41 | |
42 <xsl:attribute-set name="style2"> | |
43 <xsl:attribute name="COLOR">red</xsl:attribute> | |
44 <xsl:attribute name="SIZE">+0</xsl:attribute> | |
45 </xsl:attribute-set> | |
46 | |
47 <!-- root rule --> | |
48 <xsl:template match="/"> | |
49 <xsl:processing-instruction name="foo"> | |
50 this is a test processing instruction | |
51 </xsl:processing-instruction> | |
52 <xsl:comment>TransforMiiX Test cases, written by Keith Visco.</xsl:comment> | |
53 <xsl:apply-templates/> | |
54 </xsl:template> | |
55 | |
56 <!-- named template --> | |
57 <xsl:template name="named-template-test"> | |
58 <xsl:param name="my-param" select="'default value'"/> | |
59 named template processed with <xsl:text> </xsl:text> | |
60 <xsl:value-of select="$my-param"/>! | |
61 <xsl:if test="$dummy-param"> | |
62 <BR/> | |
63 <FONT COLOR="red"> | |
64 Error, undeclared parameters should be ignored! | |
65 </FONT> | |
66 </xsl:if> | |
67 </xsl:template> | |
68 | |
69 <!-- empty variable for named template test --> | |
70 <xsl:variable name="dummy-param" /> | |
71 | |
72 <!-- supress non-selected nodes--> | |
73 <xsl:template match="*"/> | |
74 | |
75 <!-- variable tests --> | |
76 <xsl:variable name="product-name"> | |
77 Transfor<FONT COLOR="blue">Mii</FONT>X | |
78 </xsl:variable> | |
79 <!-- main rule for document element --> | |
80 <xsl:template match="document"> | |
81 <HTML> | |
82 <HEAD> | |
83 <TITLE>TransforMiiX Test Cases</TITLE> | |
84 <SCRIPT Language="JavaScript"> | |
85 <xsl:text> | |
86 // Support for Apple's DumpRenderTree | |
87 if (window.testRunner) | |
88 testRunner.dumpAsText(); | |
89 // This is a test for properly printing SCRIPT elements | |
90 // currently there is a bug, so use xsl:text as a wrapper as I | |
91 // have done here | |
92 function foo() { | |
93 var x = 1; | |
94 var y = 2; | |
95 return (x < y); | |
96 } | |
97 // | |
98 </xsl:text> | |
99 </SCRIPT> | |
100 </HEAD> | |
101 <BODY BGColor="#FFFFFF" Text="#000000"> | |
102 <CENTER> | |
103 <FONT COLOR="BLUE" FACE="Arial" SIZE="+1"> | |
104 <B>Mozilla XSLT</B> | |
105 </FONT> | |
106 <BR/> | |
107 <B>Transfor<FONT COLOR="blue">Mii</FONT>X Test Cases</B> | |
108 </CENTER> | |
109 <P> | |
110 This document serves to test basic XSL expressions. | |
111 </P> | |
112 <!-- new test --> | |
113 <P> | |
114 <B>Testing xsl:variable and xsl:copy-of</B><BR/> | |
115 <B>Test:</B> <xsl:copy-of select="$product-name"/><BR/> | |
116 <B>Desired Result:</B>Transfor<FONT COLOR="blue">Mii</FONT>X<BR/> | |
117 <B>Result:</B><xsl:copy-of select="$product-name"/> | |
118 </P> | |
119 <!-- new test --> | |
120 <P> | |
121 <B>Testing xsl:if</B><BR/> | |
122 <B>Test:</B> <xsl:if test="x | y | z">true</xsl:if><BR/> | |
123 <B>Desired Result:</B> true<BR/> | |
124 <B>Result:</B> <xsl:if test="x | y | z">true</xsl:if> | |
125 </P> | |
126 | |
127 <!-- new test --> | |
128 <P> | |
129 <B>Testing xsl:if</B><BR/> | |
130 <B>Test:</B> <xsl:if test="true()">true</xsl:if><BR/> | |
131 <B>Desired Result:</B> true<BR/> | |
132 <B>Result:</B> <xsl:if test="true()">true</xsl:if> | |
133 </P> | |
134 | |
135 <!-- new test --> | |
136 <P> | |
137 <B>Testing xsl:if</B><BR/> | |
138 <B>Test:</B> <xsl:if test="'a'='b'">a equals b</xsl:if><BR/> | |
139 <B></B> <xsl:if test="'a'!='b'">a does not equal b</xsl:if> | |
140 <BR/> | |
141 <B>Desired Result:</B> a does not equal to b<BR/> | |
142 <B>Result:</B> | |
143 <xsl:if test="'a'='b'">a equals b<BR/></xsl:if> | |
144 <xsl:if test="'a'!='b'">a does not equal b</xsl:if> | |
145 </P> | |
146 | |
147 <!-- new test --> | |
148 <P> | |
149 <B>Testing xsl:if</B><BR/> | |
150 <B>Test:</B> <xsl:if test="2+1-3"> 2+1-3 is true</xsl:if><BR/> | |
151 <B> </B><xsl:if test="not(2+1-3)"> not(2+1-3) is true</xsl:if&
gt;<BR/> | |
152 <B>Desired Result:</B>not(2+1-3) is true <BR/> | |
153 <B>Result:</B> | |
154 <xsl:if test="2+1-3">2+1-3 is true</xsl:if> | |
155 <xsl:if test="not(2+1-3)">not(2+1-3) is true</xsl:if> | |
156 </P> | |
157 | |
158 <!-- new test --> | |
159 <P> | |
160 <B>Testing xsl:choose</B><BR/> | |
161 <B>Test:</B>see source<BR/> | |
162 <B>Desired Result:</B> true<BR/> | |
163 <B>Result:</B> | |
164 <xsl:choose> | |
165 <xsl:when test="a">error - a</xsl:when> | |
166 <xsl:when test="abc/def">true</xsl:when> | |
167 <xsl:when test="b">error - b</xsl:when> | |
168 <xsl:otherwise>false</xsl:otherwise> | |
169 </xsl:choose> | |
170 </P> | |
171 <!-- new test --> | |
172 <P> | |
173 <B>Testing parent and ancestor ops</B><BR/> | |
174 <B>Test:</B>see source<BR/> | |
175 <B>Desired Result:</B> true<BR/> | |
176 <B>Result:</B><xsl:if test="//def">true</xsl:if><BR/> | |
177 | |
178 </P> | |
179 <!-- new test --> | |
180 | |
181 <P> | |
182 <B>Testing basic xsl:apply-templates</B><BR/> | |
183 <B>Test:</B><xsl:apply-templates/><BR/> | |
184 <B>Desired Result:</B>element <B>x</B>, element <B>y</B>, element <B>z</B><B
R/> | |
185 <B>Result:</B><xsl:apply-templates select="x|y|z"/> | |
186 </P> | |
187 <!-- new test --> | |
188 | |
189 <P> | |
190 <B>Testing basic xsl:apply-templates with mode</B><BR/> | |
191 <B>Test:</B><xsl:apply-templates mode="mode-test"/><BR/> | |
192 <B>Desired Result:</B>x, y, z<BR/> | |
193 <B>Result:</B><xsl:apply-templates select="x|y|z" mode="mode-test"/> | |
194 </P> | |
195 <!-- new test --> | |
196 <P> | |
197 <B>Testing predicates</B><BR/> | |
198 <B>Test:</B>see source<BR/> | |
199 <B>Desired Result:</B> <B>z</B><BR/> | |
200 <B>Result:</B> | |
201 <xsl:for-each select="*[position()=3]"> | |
202 <B><xsl:value-of select="."/></B> | |
203 </xsl:for-each> | |
204 </P> | |
205 <!-- new test --> | |
206 <P> | |
207 <B>Testing predicates</B><BR/> | |
208 <B>Test:</B>see source<BR/> | |
209 <B>Desired Result:</B><BR/> | |
210 <B>Result:</B> | |
211 <xsl:for-each select="*[false()]"> | |
212 <B><xsl:value-of select="."/></B> | |
213 </xsl:for-each> | |
214 </P> | |
215 <!-- new test --> | |
216 <P> | |
217 <B>Named Template/Call Template</B> | |
218 <P> | |
219 <B>Test:</B><xsl:call-template name="named-template-test"/><BR/> | |
220 <B>Desired Result:</B>named template processed with default value!<BR/> | |
221 <B>Result:</B><xsl:call-template name="named-template-test"/> | |
222 </P> | |
223 <P> | |
224 <B>Test:</B> - passing arguments to named templates (see xsl source)<BR/> | |
225 <B>Desired Result:</B>named template processed with passed value!<BR/> | |
226 <B>Result:</B> | |
227 <xsl:call-template name="named-template-test"> | |
228 <xsl:with-param name="my-param" select="'passed value'"/> | |
229 <xsl:with-param name="dummy-param" select="'test'"/> | |
230 </xsl:call-template> | |
231 </P> | |
232 </P> | |
233 <!-- new test --> | |
234 <P> | |
235 <B>Attribute Value Templates and variables</B><BR/> | |
236 <B>Test:</B> | |
237 <UL> | |
238 <xsl:variable name="color">red</xsl:variable><BR/> | |
239 <FONT COLOR="{$color}">Red Text</FONT> | |
240 </UL> | |
241 <B>Desired Result:</B> | |
242 <FONT COLOR="red">Red Text</FONT><BR/> | |
243 <B>Result:</B> | |
244 <xsl:variable name="color">red</xsl:variable> | |
245 <FONT COLOR="{$color}">Red Text</FONT> | |
246 </P> | |
247 <HR/> | |
248 <!-- AXIS IDENTIFIER TESTS --> | |
249 <TABLE> | |
250 <TR BGColor="#E0E0FF"> | |
251 <TD Colspan="2" ALIGN="CENTER"> | |
252 <B>Axis Identifiers (these should work, I need more test cases though)<
/B> | |
253 </TD> | |
254 </TR> | |
255 <!-- new test --> | |
256 <TR> | |
257 <TD VALIGN="TOP"><B>Test:</B></TD> | |
258 <TD> | |
259 <xsl:if test="descendant::z">true</xsl:if><BR /> | |
260 </TD> | |
261 </TR> | |
262 <TR> | |
263 <TD><B>Desired Result:</B></TD> | |
264 <TD> | |
265 <FONT COLOR="blue">true</FONT><BR/> | |
266 </TD> | |
267 </TR> | |
268 <TR> | |
269 <TD><B>Result:</B></TD> | |
270 <TD> | |
271 <xsl:if test="descendant::z"> | |
272 <FONT COLOR="blue">true</FONT> | |
273 </xsl:if> | |
274 </TD> | |
275 </TR> | |
276 <!-- new test --> | |
277 <TR> | |
278 <TD VALIGN="TOP"><B>Test:</B></TD> | |
279 <TD> | |
280 <xsl:if test="not(descendant-or-self::no-element)">true</xsl:i
f><BR /> | |
281 </TD> | |
282 </TR> | |
283 <TR> | |
284 <TD><B>Desired Result:</B></TD> | |
285 <TD> | |
286 <FONT COLOR="blue">true</FONT><BR/> | |
287 </TD> | |
288 </TR> | |
289 <TR> | |
290 <TD><B>Result:</B></TD> | |
291 <TD> | |
292 <xsl:if test="not(descendant-or-self::no-element)"> | |
293 <FONT COLOR="blue">true</FONT> | |
294 </xsl:if> | |
295 </TD> | |
296 </TR> | |
297 <!-- new test --> | |
298 <TR> | |
299 <TD VALIGN="TOP"><B>Test:</B></TD> | |
300 <TD> | |
301 <xsl:value-of select="count(x/attribute::*)"/><BR /> | |
302 </TD> | |
303 </TR> | |
304 <TR> | |
305 <TD><B>Desired Result:</B></TD> | |
306 <TD> | |
307 <FONT COLOR="blue">1</FONT><BR/> | |
308 </TD> | |
309 </TR> | |
310 <TR> | |
311 <TD><B>Result:</B></TD> | |
312 <TD> | |
313 <FONT COLOR="blue"><xsl:value-of select="count(x/attribute::*)"/></FONT
> | |
314 </TD> | |
315 </TR> | |
316 </TABLE> | |
317 | |
318 <HR/> | |
319 <TABLE> | |
320 <TR BGColor="#E0E0FF"> | |
321 <TD Colspan="2" ALIGN="CENTER"> | |
322 <B>Creating Elements with xsl:element and xsl:attribute</B> | |
323 </TD> | |
324 </TR> | |
325 <!-- new test --> | |
326 <TR> | |
327 <TD VALIGN="TOP"><B>Test:</B></TD> | |
328 <TD> | |
329 <xsl:element name="FONT"><BR /> | |
330 <xsl:attribute name="COLOR">blue</xsl:attribute> <BR/> | |
331 Passed <BR/> | |
332 </xsl:element> | |
333 </TD> | |
334 </TR> | |
335 <TR> | |
336 <TD><B>Desired Result:</B></TD> | |
337 <TD> | |
338 <FONT COLOR="blue">Passed</FONT><BR/> | |
339 </TD> | |
340 </TR> | |
341 <TR> | |
342 <TD><B>Result:</B></TD> | |
343 <TD> | |
344 <xsl:element name="FONT"> | |
345 <xsl:attribute name="COLOR">blue</xsl:attribute> | |
346 Passed | |
347 </xsl:element> | |
348 </TD> | |
349 </TR> | |
350 <!-- new test --> | |
351 <TR BGCOLOR="#E0E0FF" ALIGN="CENTER"> | |
352 <TD COLSPAN="2"><B>Using Attribute Sets</B></TD> | |
353 </TR> | |
354 <TR> | |
355 <TD VALIGN="TOP"><B>Test:</B></TD> | |
356 <TD> | |
357 <FONT xsl:use-attribute-sets="style1"><BR /> | |
358 Passed <BR/> | |
359 </FONT> | |
360 </TD> | |
361 </TR> | |
362 <TR> | |
363 <TD><B>Desired Result:</B></TD> | |
364 <TD> | |
365 <FONT COLOR="blue">Passed</FONT><BR/> | |
366 </TD> | |
367 </TR> | |
368 <TR> | |
369 <TD><B>Result:</B></TD> | |
370 <TD> | |
371 <FONT xsl:use-attribute-sets="style1"> | |
372 Passed | |
373 </FONT> | |
374 </TD> | |
375 </TR> | |
376 <!-- new test --> | |
377 <TR> | |
378 <TD VALIGN="TOP"><B>Test:</B></TD> | |
379 <TD> | |
380 <xsl:element name="FONT" use-attribute-sets="style1 style2"><BR /
> | |
381 Passed <BR/> | |
382 </xsl:element> | |
383 </TD> | |
384 </TR> | |
385 <TR> | |
386 <TD><B>Desired Result:</B></TD> | |
387 <TD> | |
388 <FONT COLOR="red">Passed</FONT><BR/> | |
389 </TD> | |
390 </TR> | |
391 <TR> | |
392 <TD><B>Result:</B></TD> | |
393 <TD> | |
394 <xsl:element name="FONT" use-attribute-sets="style1 style2"> | |
395 Passed | |
396 </xsl:element> | |
397 </TD> | |
398 </TR> | |
399 </TABLE> | |
400 <HR/> | |
401 <!-- NUMBERING Examples --> | |
402 <TABLE> | |
403 <TR BGColor="#E0E0FF"> | |
404 <TD Colspan="2" ALIGN="CENTER"> | |
405 <B>Numbering (only simple numbering currently implemented)</B> | |
406 </TD> | |
407 </TR> | |
408 <!-- new test --> | |
409 <TR> | |
410 <TD VALIGN="TOP"><B>Test:</B></TD> | |
411 <TD> | |
412 <xsl:number value="4"/><BR /> | |
413 </TD> | |
414 </TR> | |
415 <TR> | |
416 <TD><B>Desired Result:</B></TD> | |
417 <TD> | |
418 <FONT COLOR="blue">4</FONT><BR/> | |
419 </TD> | |
420 </TR> | |
421 <TR> | |
422 <TD><B>Result:</B></TD> | |
423 <TD> | |
424 <FONT COLOR="blue"><xsl:number value="4"/></FONT> | |
425 </TD> | |
426 </TR> | |
427 <!-- new test --> | |
428 <TR> | |
429 <TD VALIGN="TOP"><B>Test:</B></TD> | |
430 <TD> | |
431 see source<BR /> | |
432 </TD> | |
433 </TR> | |
434 <TR> | |
435 <TD><B>Desired Result:</B></TD> | |
436 <TD> | |
437 <FONT COLOR="blue"> | |
438 1. x <BR/>1. y<BR/>1. z | |
439 </FONT><BR/> | |
440 </TD> | |
441 </TR> | |
442 <TR> | |
443 <TD><B>Result:</B></TD> | |
444 <TD> | |
445 <FONT COLOR="blue"> | |
446 <xsl:for-each select="x | y | z"> | |
447 <xsl:number/> | |
448 <xsl:text>. </xsl:text><xsl:value-of select="."/><BR/> | |
449 </xsl:for-each> | |
450 </FONT> | |
451 </TD> | |
452 </TR> | |
453 | |
454 </TABLE> | |
455 | |
456 <HR/> | |
457 <!-- ADDITIVE EXPRESSION TESTS --> | |
458 <TABLE> | |
459 <TR BGColor="#E0E0FF"> | |
460 <TD Colspan="2" ALIGN="CENTER"> | |
461 <B>Additive Expressions</B> | |
462 </TD> | |
463 </TR> | |
464 <!-- new test --> | |
465 <TR> | |
466 <TD VALIGN="TOP"><B>Test:</B></TD> | |
467 <TD> | |
468 <xsl:value-of select="70+4"/><BR /> | |
469 </TD> | |
470 </TR> | |
471 <TR> | |
472 <TD><B>Desired Result:</B></TD> | |
473 <TD> | |
474 <FONT COLOR="blue">74</FONT><BR/> | |
475 </TD> | |
476 </TR> | |
477 <TR> | |
478 <TD><B>Result:</B></TD> | |
479 <TD> | |
480 <FONT COLOR="blue"> | |
481 <xsl:value-of select="70+4"/> | |
482 </FONT> | |
483 </TD> | |
484 </TR> | |
485 <!-- new test --> | |
486 <TR> | |
487 <TD VALIGN="TOP"><B>Test:</B></TD> | |
488 <TD> | |
489 <xsl:value-of select="-70+4"/><BR /> | |
490 </TD> | |
491 </TR> | |
492 <TR> | |
493 <TD><B>Desired Result:</B></TD> | |
494 <TD> | |
495 <FONT COLOR="blue">-66</FONT><BR/> | |
496 </TD> | |
497 </TR> | |
498 <TR> | |
499 <TD><B>Result:</B></TD> | |
500 <TD> | |
501 <FONT COLOR="blue"> | |
502 <xsl:value-of select="-70+4"/> | |
503 </FONT> | |
504 </TD> | |
505 </TR> | |
506 <TR> | |
507 <TD VALIGN="TOP"><B>Test:</B></TD> | |
508 <TD> | |
509 <xsl:value-of select="1900+70+8-4"/><BR /> | |
510 </TD> | |
511 </TR> | |
512 <TR> | |
513 <TD><B>Desired Result:</B></TD> | |
514 <TD> | |
515 <FONT COLOR="blue">1974</FONT><BR/> | |
516 </TD> | |
517 </TR> | |
518 <TR> | |
519 <TD><B>Result:</B></TD> | |
520 <TD> | |
521 <FONT COLOR="blue"> | |
522 <xsl:value-of select="1900+70+8-4"/> | |
523 </FONT> | |
524 </TD> | |
525 </TR> | |
526 <TR> | |
527 <TD VALIGN="TOP"><B>Test:</B></TD> | |
528 <TD> | |
529 <xsl:value-of select="(4+5)-(9+9)"/><BR /> | |
530 </TD> | |
531 </TR> | |
532 <TR> | |
533 <TD><B>Desired Result:</B></TD> | |
534 <TD> | |
535 <FONT COLOR="blue">-9</FONT><BR/> | |
536 </TD> | |
537 </TR> | |
538 <TR> | |
539 <TD><B>Result:</B></TD> | |
540 <TD> | |
541 <FONT COLOR="blue"> | |
542 <xsl:value-of select="(4+5)-(9+9)"/> | |
543 </FONT> | |
544 </TD> | |
545 </TR> | |
546 | |
547 </TABLE> | |
548 <HR/> | |
549 <!-- MULTIPLICATIVE EXPRESSION TESTS --> | |
550 <TABLE> | |
551 <TR BGColor="#E0E0FF"> | |
552 <TD Colspan="2" ALIGN="CENTER"> | |
553 <B>Multiplicative Expressions</B> | |
554 </TD> | |
555 </TR> | |
556 <!-- new test --> | |
557 <TR> | |
558 <TD VALIGN="TOP"><B>Test:</B></TD> | |
559 <TD> | |
560 <xsl:value-of select="7*4"/><BR /> | |
561 </TD> | |
562 </TR> | |
563 <TR> | |
564 <TD><B>Desired Result:</B></TD> | |
565 <TD> | |
566 <FONT COLOR="blue">28</FONT><BR/> | |
567 </TD> | |
568 </TR> | |
569 <TR> | |
570 <TD><B>Result:</B></TD> | |
571 <TD> | |
572 <FONT COLOR="blue"> | |
573 <xsl:value-of select="7*4"/> | |
574 </FONT> | |
575 </TD> | |
576 </TR> | |
577 <!-- new test --> | |
578 <TR> | |
579 <TD VALIGN="TOP"><B>Test:</B></TD> | |
580 <TD> | |
581 <xsl:value-of select="7mod 4"/><BR /> | |
582 </TD> | |
583 </TR> | |
584 <TR> | |
585 <TD><B>Desired Result:</B></TD> | |
586 <TD> | |
587 <FONT COLOR="blue">3</FONT><BR/> | |
588 </TD> | |
589 </TR> | |
590 <TR> | |
591 <TD><B>Result:</B></TD> | |
592 <TD> | |
593 <FONT COLOR="blue"> | |
594 <xsl:value-of select="7mod 4"/> | |
595 </FONT> | |
596 </TD> | |
597 </TR> | |
598 <!-- new test --> | |
599 <TR> | |
600 <TD VALIGN="TOP"><B>Test:</B></TD> | |
601 <TD> | |
602 <xsl:value-of select="7div 4"/><BR /> | |
603 </TD> | |
604 </TR> | |
605 <TR> | |
606 <TD><B>Desired Result:</B></TD> | |
607 <TD> | |
608 <FONT COLOR="blue">1.75</FONT><BR/> | |
609 </TD> | |
610 </TR> | |
611 <TR> | |
612 <TD><B>Result:</B></TD> | |
613 <TD> | |
614 <FONT COLOR="blue"> | |
615 <xsl:value-of select="7div 4"/> | |
616 </FONT> | |
617 </TD> | |
618 </TR> | |
619 <!-- new test --> | |
620 <TR> | |
621 <TD VALIGN="TOP"><B>Test:</B></TD> | |
622 <TD> | |
623 <xsl:value-of select="7div 0"/><BR /> | |
624 </TD> | |
625 </TR> | |
626 <TR> | |
627 <TD><B>Desired Result:</B></TD> | |
628 <TD> | |
629 <FONT COLOR="blue">Infinity</FONT><BR/> | |
630 </TD> | |
631 </TR> | |
632 <TR> | |
633 <TD><B>Result:</B></TD> | |
634 <TD> | |
635 <FONT COLOR="blue"> | |
636 <xsl:value-of select="7div 0"/> | |
637 </FONT> | |
638 </TD> | |
639 </TR> | |
640 <!-- new test --> | |
641 <TR> | |
642 <TD VALIGN="TOP"><B>Test:</B></TD> | |
643 <TD> | |
644 <xsl:value-of select="0 div 0"/><BR /> | |
645 </TD> | |
646 </TR> | |
647 <TR> | |
648 <TD><B>Desired Result:</B></TD> | |
649 <TD> | |
650 <FONT COLOR="blue">NaN</FONT><BR/> | |
651 </TD> | |
652 </TR> | |
653 <TR> | |
654 <TD><B>Result:</B></TD> | |
655 <TD> | |
656 <FONT COLOR="blue"> | |
657 <xsl:value-of select="0 div 0"/> | |
658 </FONT> | |
659 </TD> | |
660 </TR> | |
661 | |
662 <!-- new test --> | |
663 <TR> | |
664 <TD VALIGN="TOP"><B>Test:</B></TD> | |
665 <TD> | |
666 <xsl:variable name="x" select="7*3"/><BR /> | |
667 <xsl:variable name="y" select="3"/><BR /> | |
668 <xsl:value-of select="$x div $y"/><BR /> | |
669 </TD> | |
670 </TR> | |
671 <TR> | |
672 <TD><B>Desired Result:</B></TD> | |
673 <TD> | |
674 <FONT COLOR="blue">7</FONT><BR/> | |
675 </TD> | |
676 </TR> | |
677 <TR> | |
678 <TD><B>Result:</B></TD> | |
679 <TD> | |
680 <FONT COLOR="blue"> | |
681 <xsl:variable name="x" select="7*3"/> | |
682 <xsl:variable name="y" select="3"/> | |
683 <xsl:value-of select="$x div $y"/> | |
684 <BR/> | |
685 | |
686 </FONT> | |
687 </TD> | |
688 </TR> | |
689 </TABLE> | |
690 <!-- PRECEDENCE TESTS --> | |
691 <TABLE> | |
692 <TR BGColor="#E0E0FF"> | |
693 <TD Colspan="2" ALIGN="CENTER"> | |
694 <B>Precedence tests</B> | |
695 </TD> | |
696 </TR> | |
697 <!-- new test --> | |
698 <TR> | |
699 <TD VALIGN="TOP"><B>Test:</B></TD> | |
700 <TD> | |
701 <xsl:value-of select="2 mod 2 = 0"/><BR /> | |
702 </TD> | |
703 </TR> | |
704 <TR> | |
705 <TD><B>Desired Result:</B></TD> | |
706 <TD> | |
707 <FONT COLOR="blue">true</FONT><BR/> | |
708 </TD> | |
709 </TR> | |
710 <TR> | |
711 <TD><B>Result:</B></TD> | |
712 <TD> | |
713 <FONT COLOR="blue"> | |
714 <xsl:value-of select="2 mod 2 = 0"/> | |
715 </FONT> | |
716 </TD> | |
717 </TR> | |
718 <!-- new test --> | |
719 <TR> | |
720 <TD VALIGN="TOP"><B>Test:</B></TD> | |
721 <TD> | |
722 <xsl:value-of select="5 mod 2 < 5 and 2*6 >= 12"/><BR /> | |
723 </TD> | |
724 </TR> | |
725 <TR> | |
726 <TD><B>Desired Result:</B></TD> | |
727 <TD> | |
728 <FONT COLOR="blue">true</FONT><BR/> | |
729 </TD> | |
730 </TR> | |
731 <TR> | |
732 <TD><B>Result:</B></TD> | |
733 <TD> | |
734 <FONT COLOR="blue"> | |
735 <xsl:value-of select="5 mod 2 < 5 and 2*6>=12"/> | |
736 </FONT> | |
737 </TD> | |
738 </TR> | |
739 <!-- new test --> | |
740 <TR> | |
741 <TD VALIGN="TOP"><B>Test:</B></TD> | |
742 <TD> | |
743 <xsl:value-of select="5 mod 2 < 5 and 2*6>12"/><BR /> | |
744 </TD> | |
745 </TR> | |
746 <TR> | |
747 <TD><B>Desired Result:</B></TD> | |
748 <TD> | |
749 <FONT COLOR="blue">false</FONT><BR/> | |
750 </TD> | |
751 </TR> | |
752 <TR> | |
753 <TD><B>Result:</B></TD> | |
754 <TD> | |
755 <FONT COLOR="blue"> | |
756 <xsl:value-of select="5 mod 2 < 5 and 2*6>12"/> | |
757 </FONT> | |
758 </TD> | |
759 </TR> | |
760 | |
761 <!-- new test --> | |
762 <TR> | |
763 <TD VALIGN="TOP"><B>Test:</B></TD> | |
764 <TD> | |
765 <xsl:value-of select="4+5*3"/><BR /> | |
766 </TD> | |
767 </TR> | |
768 <TR> | |
769 <TD><B>Desired Result:</B></TD> | |
770 <TD> | |
771 <FONT COLOR="blue">19</FONT><BR/> | |
772 </TD> | |
773 </TR> | |
774 <TR> | |
775 <TD><B>Result:</B></TD> | |
776 <TD> | |
777 <FONT COLOR="blue"> | |
778 <xsl:value-of select="4+5*3"/> | |
779 </FONT> | |
780 </TD> | |
781 </TR> | |
782 <!-- new test --> | |
783 <TR> | |
784 <TD VALIGN="TOP"><B>Test:</B></TD> | |
785 <TD> | |
786 <xsl:value-of select="4+5*3+(6-4)*7"/><BR /> | |
787 </TD> | |
788 </TR> | |
789 <TR> | |
790 <TD><B>Desired Result:</B></TD> | |
791 <TD> | |
792 <FONT COLOR="blue">33</FONT><BR/> | |
793 </TD> | |
794 </TR> | |
795 <TR> | |
796 <TD><B>Result:</B></TD> | |
797 <TD> | |
798 <FONT COLOR="blue"> | |
799 <xsl:value-of select="4+5*3+(6-4)*7"/> | |
800 </FONT> | |
801 </TD> | |
802 </TR> | |
803 </TABLE> | |
804 | |
805 <!-- Result Type conversion tests --> | |
806 <TABLE> | |
807 <TR BGColor="#E0E0FF"> | |
808 <TD Colspan="2" ALIGN="CENTER"> | |
809 <B>Automatic Result Type Conversion</B> | |
810 </TD> | |
811 </TR> | |
812 <!-- new test --> | |
813 <TR> | |
814 <TD VALIGN="TOP"><B>Test:</B></TD> | |
815 <TD> | |
816 <xsl:value-of select="'747' + 8"/><BR /> | |
817 </TD> | |
818 </TR> | |
819 <TR> | |
820 <TD><B>Desired Result:</B></TD> | |
821 <TD> | |
822 <FONT COLOR="blue">755</FONT><BR/> | |
823 </TD> | |
824 </TR> | |
825 <TR> | |
826 <TD><B>Result:</B></TD> | |
827 <TD> | |
828 <FONT COLOR="blue"> | |
829 <xsl:value-of select="'747' + 8"/> | |
830 </FONT> | |
831 </TD> | |
832 </TR> | |
833 </TABLE> | |
834 </BODY> | |
835 </HTML> | |
836 </xsl:template> | |
837 | |
838 <!-- simple union expressions --> | |
839 <xsl:template match="x | y | z" priority="1.0"> | |
840 element<B><xsl:text> </xsl:text><xsl:value-of select="@*"/></B> | |
841 <xsl:if test="not(position()=3)">,</xsl:if> | |
842 </xsl:template> | |
843 | |
844 <xsl:template match="x | y | z" mode="mode-test"> | |
845 <xsl:value-of select="@*"/> | |
846 <xsl:if test="not(position()=3)"><xsl:text>, </xsl:text></xsl:if> | |
847 </xsl:template> | |
848 | |
849 <xsl:template match="z"> | |
850 element (z): <B><xsl:value-of select="."/></B> | |
851 </xsl:template> | |
852 | |
853 </xsl:stylesheet> | |
854 | |
OLD | NEW |