RetroZilla/extensions/transformiix/source/examples/test.html
2015-10-20 23:03:22 -04:00

747 lines
16 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<?foo this is a test processing instruction?>
<!-- TransforMiiX Test cases, written by Keith Visco. -->
<HTML>
<HEAD>
<TITLE>TransforMiiX Test Cases</TITLE>
<SCRIPT Language="JavaScript">
// This is a test for properly printing SCRIPT elements
// currently there is a bug, so use xsl:text as a wrapper as I
// have done here
function foo() {
var x = 1;
var y = 2;
return (x < y);
}
//
</SCRIPT>
</HEAD>
<BODY BGColor="#FFFFFF" Text="#000000">
<CENTER>
<FONT COLOR="BLUE" FACE="Arial" SIZE="+1">
<B>Mozilla XSLT</B>
</FONT>
<BR>
<B>Transfor<FONT COLOR="blue">Mii</FONT>X Test Cases</B>
</CENTER>
<P>This document serves to test basic XSL expressions.</P>
<P>
<B>Testing xsl:variable and xsl:copy-of</B>
<BR>
<B>Test:</B>&lt;xsl:copy-of select="$product-name"/&gt;<BR>
<B>Desired Result:</B>Transfor<FONT COLOR="blue">Mii</FONT>X<BR>
<B>Result:</B>Transfor<FONT COLOR="blue">Mii</FONT>X</P>
<P>
<B>Testing xsl:if</B>
<BR>
<B>Test:</B>&lt;xsl:if test="x | y | z"&gt;true&lt;/xsl:if&gt;<BR>
<B>Desired Result:</B>true<BR>
<B>Result:</B>true</P>
<P>
<B>Testing xsl:if</B>
<BR>
<B>Test:</B>&lt;xsl:if test="true()"&gt;true&lt;/xsl:if&gt;<BR>
<B>Desired Result:</B>true<BR>
<B>Result:</B>true</P>
<P>
<B>Testing xsl:if</B>
<BR>
<B>Test:</B>&lt;xsl:if test="'a'='b'"&gt;a equals b&lt;/xsl:if&gt;<BR>
<B></B>&lt;xsl:if test="'a'!='b'"&gt;a does not equal b&lt;/xsl:if&gt;<BR>
<B>Desired Result:</B>a does not equal to b<BR>
<B>Result:</B>a does not equal b</P>
<P>
<B>Testing xsl:if</B>
<BR>
<B>Test:</B>&lt;xsl:if test="2+1-3"&gt;2+1-3 is true&lt;/xsl:if&gt;<BR>
<B>&#160;</B>&lt;xsl:if test="not(2+1-3)"&gt;not(2+1-3) is true&lt;/xsl:if&gt;<BR>
<B>Desired Result:</B>not(2+1-3) is true<BR>
<B>Result:</B>not(2+1-3) is true</P>
<P>
<B>Testing xsl:choose</B>
<BR>
<B>Test:</B>see source<BR>
<B>Desired Result:</B>true<BR>
<B>Result:</B>true</P>
<P>
<B>Testing parent and ancestor ops</B>
<BR>
<B>Test:</B>see source<BR>
<B>Desired Result:</B>true<BR>
<B>Result:</B>true<BR>
</P>
<P>
<B>Testing basic xsl:apply-templates</B>
<BR>
<B>Test:</B>&lt;xsl:apply-templates/&gt;<BR>
<B>Desired Result:</B>element x, element y, element z<BR>
<B>Result:</B>
,element<B> x</B>
,element<B> y</B>
,element<B> z</B>
</P>
<P>
<B>Testing basic xsl:apply-templates with mode</B>
<BR>
<B>Test:</B>&lt;xsl:apply-templates mode="mode-test"/&gt;<BR>
<B>Desired Result:</B>x, y, z<BR>
<B>Result:</B>, x, y, z</P>
<P>
<B>Testing predicates</B>
<BR>
<B>Test:</B>see source<BR>
<B>Desired Result:</B>
<B>z</B>
<BR>
<B>Result:</B>
<B>z</B>
</P>
<P>
<B>Testing predicates</B>
<BR>
<B>Test:</B>see source<BR>
<B>Desired Result:</B>
<BR>
<B>Result:</B>
</P>
<P>
<B>Named Template/Call Template</B>
<P>
<B>Test:</B>&lt;xsl:call-template name="named-template-test"/&gt;<BR>
<B>Desired Result:</B>named template processed with default value!<BR>
<B>Result:</B>named template processed with default value!</P>
<P>
<B>Test:</B>- passing arguments to named templates (see xsl source)<BR>
<B>Desired Result:</B>named template processed with passed value!<BR>
<B>Result:</B>named template processed with passed value!</P>
</P>
<P>
<B>Attribute Value Templates and variables</B>
<BR>
<B>Test:</B>
<UL>&lt;xsl:variable name="color"&gt;red&lt;/xsl:variable&gt;<BR>&lt;FONT COLOR="{$color}"&gt;Red Text&lt;/FONT&gt;</UL>
<B>Desired Result:</B>
<FONT COLOR="red">Red Text</FONT>
<BR>
<B>Result:</B>
<FONT COLOR="red">Red Text</FONT>
</P>
<HR>
<TABLE>
<TR BGColor="#E0E0FF">
<TD Colspan="2" ALIGN="CENTER">
<B>Axis Identifiers (these should work, I need more test cases though)</B>
</TD>
</TR>
<TR>
<TD VALIGN="TOP">
<B>Test:</B>
</TD>
<TD>&lt;xsl:if test="descendant::z"&gt;true&lt;/xsl:if&gt;<BR>
</TD>
</TR>
<TR>
<TD>
<B>Desired Result:</B>
</TD>
<TD>
<FONT COLOR="blue">true</FONT>
<BR>
</TD>
</TR>
<TR>
<TD>
<B>Result:</B>
</TD>
<TD>
<FONT COLOR="blue">true</FONT>
</TD>
</TR>
<TR>
<TD VALIGN="TOP">
<B>Test:</B>
</TD>
<TD>&lt;xsl:if test="not(descendant-or-self::no-element)"&gt;true&lt;/xsl:if&gt;<BR>
</TD>
</TR>
<TR>
<TD>
<B>Desired Result:</B>
</TD>
<TD>
<FONT COLOR="blue">true</FONT>
<BR>
</TD>
</TR>
<TR>
<TD>
<B>Result:</B>
</TD>
<TD>
<FONT COLOR="blue">true</FONT>
</TD>
</TR>
</TABLE>
<HR>
<TABLE>
<TR BGColor="#E0E0FF">
<TD Colspan="2" ALIGN="CENTER">
<B>Creating Elements with xsl:element and xsl:attribute</B>
</TD>
</TR>
<TR>
<TD VALIGN="TOP">
<B>Test:</B>
</TD>
<TD>&lt;xsl:element name="FONT"&gt;<BR>&lt;xsl:attribute name="COLOR"&gt;blue&lt;/xsl:attribute&gt;<BR>Passed<BR>&lt;/xsl:element&gt;</TD>
</TR>
<TR>
<TD>
<B>Desired Result:</B>
</TD>
<TD>
<FONT COLOR="blue">Passed</FONT>
<BR>
</TD>
</TR>
<TR>
<TD>
<B>Result:</B>
</TD>
<TD>
<FONT COLOR="blue">Passed</FONT>
</TD>
</TR>
<TR BGCOLOR="#E0E0FF" ALIGN="CENTER">
<TD COLSPAN="2">
<B>Using Attribute Sets</B>
</TD>
</TR>
<TR>
<TD VALIGN="TOP">
<B>Test:</B>
</TD>
<TD>&lt;FONT xsl:use-attribute-sets="style1"&gt;<BR>Passed<BR>&lt;/FONT&gt;</TD>
</TR>
<TR>
<TD>
<B>Desired Result:</B>
</TD>
<TD>
<FONT COLOR="blue">Passed</FONT>
<BR>
</TD>
</TR>
<TR>
<TD>
<B>Result:</B>
</TD>
<TD>
<FONT COLOR="blue" SIZE="+0">Passed</FONT>
</TD>
</TR>
<TR>
<TD VALIGN="TOP">
<B>Test:</B>
</TD>
<TD>&lt;xsl:element name="FONT" use-attribute-sets="style1 style2"&gt;<BR>Passed<BR>&lt;/xsl:element&gt;</TD>
</TR>
<TR>
<TD>
<B>Desired Result:</B>
</TD>
<TD>
<FONT COLOR="red">Passed</FONT>
<BR>
</TD>
</TR>
<TR>
<TD>
<B>Result:</B>
</TD>
<TD>
<FONT COLOR="red" SIZE="+0">Passed</FONT>
</TD>
</TR>
</TABLE>
<HR>
<TABLE>
<TR BGColor="#E0E0FF">
<TD Colspan="2" ALIGN="CENTER">
<B>Numbering (only simple numbering currently implemented)</B>
</TD>
</TR>
<TR>
<TD VALIGN="TOP">
<B>Test:</B>
</TD>
<TD>&lt;xsl:number value="4"/&gt;<BR>
</TD>
</TR>
<TR>
<TD>
<B>Desired Result:</B>
</TD>
<TD>
<FONT COLOR="blue">4</FONT>
<BR>
</TD>
</TR>
<TR>
<TD>
<B>Result:</B>
</TD>
<TD>
<FONT COLOR="blue">4</FONT>
</TD>
</TR>
<TR>
<TD VALIGN="TOP">
<B>Test:</B>
</TD>
<TD>see source<BR>
</TD>
</TR>
<TR>
<TD>
<B>Desired Result:</B>
</TD>
<TD>
<FONT COLOR="blue">1. x<BR>1. y<BR>1. z</FONT>
<BR>
</TD>
</TR>
<TR>
<TD>
<B>Result:</B>
</TD>
<TD>
<FONT COLOR="blue">1. x<BR>1. y<BR>1. z<BR>
</FONT>
</TD>
</TR>
</TABLE>
<HR>
<TABLE>
<TR BGColor="#E0E0FF">
<TD Colspan="2" ALIGN="CENTER">
<B>Additive Expressions</B>
</TD>
</TR>
<TR>
<TD VALIGN="TOP">
<B>Test:</B>
</TD>
<TD>&lt;xsl:value-of select="70+4"/&gt;<BR>
</TD>
</TR>
<TR>
<TD>
<B>Desired Result:</B>
</TD>
<TD>
<FONT COLOR="blue">74</FONT>
<BR>
</TD>
</TR>
<TR>
<TD>
<B>Result:</B>
</TD>
<TD>
<FONT COLOR="blue">74</FONT>
</TD>
</TR>
<TR>
<TD VALIGN="TOP">
<B>Test:</B>
</TD>
<TD>&lt;xsl:value-of select="-70+4"/&gt;<BR>
</TD>
</TR>
<TR>
<TD>
<B>Desired Result:</B>
</TD>
<TD>
<FONT COLOR="blue">-66</FONT>
<BR>
</TD>
</TR>
<TR>
<TD>
<B>Result:</B>
</TD>
<TD>
<FONT COLOR="blue">-66</FONT>
</TD>
</TR>
<TR>
<TD VALIGN="TOP">
<B>Test:</B>
</TD>
<TD>&lt;xsl:value-of select="1900+70+8-4"/&gt;<BR>
</TD>
</TR>
<TR>
<TD>
<B>Desired Result:</B>
</TD>
<TD>
<FONT COLOR="blue">1974</FONT>
<BR>
</TD>
</TR>
<TR>
<TD>
<B>Result:</B>
</TD>
<TD>
<FONT COLOR="blue">1974</FONT>
</TD>
</TR>
<TR>
<TD VALIGN="TOP">
<B>Test:</B>
</TD>
<TD>&lt;xsl:value-of select="(4+5)-(9+9)"/&gt;<BR>
</TD>
</TR>
<TR>
<TD>
<B>Desired Result:</B>
</TD>
<TD>
<FONT COLOR="blue">-9</FONT>
<BR>
</TD>
</TR>
<TR>
<TD>
<B>Result:</B>
</TD>
<TD>
<FONT COLOR="blue">-9</FONT>
</TD>
</TR>
</TABLE>
<HR>
<TABLE>
<TR BGColor="#E0E0FF">
<TD Colspan="2" ALIGN="CENTER">
<B>Multiplicative Expressions</B>
</TD>
</TR>
<TR>
<TD VALIGN="TOP">
<B>Test:</B>
</TD>
<TD>&lt;xsl:value-of select="7*4"/&gt;<BR>
</TD>
</TR>
<TR>
<TD>
<B>Desired Result:</B>
</TD>
<TD>
<FONT COLOR="blue">28</FONT>
<BR>
</TD>
</TR>
<TR>
<TD>
<B>Result:</B>
</TD>
<TD>
<FONT COLOR="blue">28</FONT>
</TD>
</TR>
<TR>
<TD VALIGN="TOP">
<B>Test:</B>
</TD>
<TD>&lt;xsl:value-of select="7mod4"/&gt;<BR>
</TD>
</TR>
<TR>
<TD>
<B>Desired Result:</B>
</TD>
<TD>
<FONT COLOR="blue">3</FONT>
<BR>
</TD>
</TR>
<TR>
<TD>
<B>Result:</B>
</TD>
<TD>
<FONT COLOR="blue">3</FONT>
</TD>
</TR>
<TR>
<TD VALIGN="TOP">
<B>Test:</B>
</TD>
<TD>&lt;xsl:value-of select="7div4"/&gt;<BR>
</TD>
</TR>
<TR>
<TD>
<B>Desired Result:</B>
</TD>
<TD>
<FONT COLOR="blue">1.75</FONT>
<BR>
</TD>
</TR>
<TR>
<TD>
<B>Result:</B>
</TD>
<TD>
<FONT COLOR="blue">1.75</FONT>
</TD>
</TR>
<TR>
<TD VALIGN="TOP">
<B>Test:</B>
</TD>
<TD>&lt;xsl:value-of select="7div0"/&gt;<BR>
</TD>
</TR>
<TR>
<TD>
<B>Desired Result:</B>
</TD>
<TD>
<FONT COLOR="blue">Infinity</FONT>
<BR>
</TD>
</TR>
<TR>
<TD>
<B>Result:</B>
</TD>
<TD>
<FONT COLOR="blue">Infinity</FONT>
</TD>
</TR>
<TR>
<TD VALIGN="TOP">
<B>Test:</B>
</TD>
<TD>&lt;xsl:value-of select="0 div 0"/&gt;<BR>
</TD>
</TR>
<TR>
<TD>
<B>Desired Result:</B>
</TD>
<TD>
<FONT COLOR="blue">NaN</FONT>
<BR>
</TD>
</TR>
<TR>
<TD>
<B>Result:</B>
</TD>
<TD>
<FONT COLOR="blue">NaN</FONT>
</TD>
</TR>
<TR>
<TD VALIGN="TOP">
<B>Test:</B>
</TD>
<TD>&lt;xsl:variable name="x" select="7*3"/&gt;<BR>&lt;xsl:variable name="y" select="3"/&gt;<BR>&lt;xsl:value-of select="$x div $y"/&gt;<BR>
</TD>
</TR>
<TR>
<TD>
<B>Desired Result:</B>
</TD>
<TD>
<FONT COLOR="blue">7</FONT>
<BR>
</TD>
</TR>
<TR>
<TD>
<B>Result:</B>
</TD>
<TD>
<FONT COLOR="blue">7<BR>
</FONT>
</TD>
</TR>
</TABLE>
<TABLE>
<TR BGColor="#E0E0FF">
<TD Colspan="2" ALIGN="CENTER">
<B>Precedence tests</B>
</TD>
</TR>
<TR>
<TD VALIGN="TOP">
<B>Test:</B>
</TD>
<TD>&lt;xsl:value-of select="2 mod 2 = 0"/&gt;<BR>
</TD>
</TR>
<TR>
<TD>
<B>Desired Result:</B>
</TD>
<TD>
<FONT COLOR="blue">true</FONT>
<BR>
</TD>
</TR>
<TR>
<TD>
<B>Result:</B>
</TD>
<TD>
<FONT COLOR="blue">true</FONT>
</TD>
</TR>
<TR>
<TD VALIGN="TOP">
<B>Test:</B>
</TD>
<TD>&lt;xsl:value-of select="5 mod 2&lt;5 and 2*6&gt;= 12"/&gt;<BR>
</TD>
</TR>
<TR>
<TD>
<B>Desired Result:</B>
</TD>
<TD>
<FONT COLOR="blue">true</FONT>
<BR>
</TD>
</TR>
<TR>
<TD>
<B>Result:</B>
</TD>
<TD>
<FONT COLOR="blue">true</FONT>
</TD>
</TR>
<TR>
<TD VALIGN="TOP">
<B>Test:</B>
</TD>
<TD>&lt;xsl:value-of select="5 mod 2&lt;5 and 2*6&gt;12"/&gt;<BR>
</TD>
</TR>
<TR>
<TD>
<B>Desired Result:</B>
</TD>
<TD>
<FONT COLOR="blue">false</FONT>
<BR>
</TD>
</TR>
<TR>
<TD>
<B>Result:</B>
</TD>
<TD>
<FONT COLOR="blue">false</FONT>
</TD>
</TR>
<TR>
<TD VALIGN="TOP">
<B>Test:</B>
</TD>
<TD>&lt;xsl:value-of select="4+5*3"/&gt;<BR>
</TD>
</TR>
<TR>
<TD>
<B>Desired Result:</B>
</TD>
<TD>
<FONT COLOR="blue">19</FONT>
<BR>
</TD>
</TR>
<TR>
<TD>
<B>Result:</B>
</TD>
<TD>
<FONT COLOR="blue">19</FONT>
</TD>
</TR>
<TR>
<TD VALIGN="TOP">
<B>Test:</B>
</TD>
<TD>&lt;xsl:value-of select="4+5*3+(6-4)*7"/&gt;<BR>
</TD>
</TR>
<TR>
<TD>
<B>Desired Result:</B>
</TD>
<TD>
<FONT COLOR="blue">33</FONT>
<BR>
</TD>
</TR>
<TR>
<TD>
<B>Result:</B>
</TD>
<TD>
<FONT COLOR="blue">33</FONT>
</TD>
</TR>
</TABLE>
<TABLE>
<TR BGColor="#E0E0FF">
<TD Colspan="2" ALIGN="CENTER">
<B>Automatic Result Type Conversion</B>
</TD>
</TR>
<TR>
<TD VALIGN="TOP">
<B>Test:</B>
</TD>
<TD>&lt;xsl:value-of select="'747' + 8"/&gt;<BR>
</TD>
</TR>
<TR>
<TD>
<B>Desired Result:</B>
</TD>
<TD>
<FONT COLOR="blue">755</FONT>
<BR>
</TD>
</TR>
<TR>
<TD>
<B>Result:</B>
</TD>
<TD>
<FONT COLOR="blue">755</FONT>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>