Mozilla XSLT
TransforMiiX Test Cases

This document serves to test basic XSL expressions.

Testing xsl:variable and xsl:copy-of
Test:<xsl:copy-of select="$product-name"/>
Desired Result:TransforMiiX
Result:TransforMiiX

Testing xsl:if
Test:<xsl:if test="x | y | z">true</xsl:if>
Desired Result:true
Result:true

Testing xsl:if
Test:<xsl:if test="true()">true</xsl:if>
Desired Result:true
Result:true

Testing xsl:if
Test:<xsl:if test="'a'='b'">a equals b</xsl:if>
<xsl:if test="'a'!='b'">a does not equal b</xsl:if>
Desired Result:a does not equal to b
Result:a does not equal b

Testing xsl:if
Test:<xsl:if test="2+1-3">2+1-3 is true</xsl:if>
 <xsl:if test="not(2+1-3)">not(2+1-3) is true</xsl:if>
Desired Result:not(2+1-3) is true
Result:not(2+1-3) is true

Testing xsl:choose
Test:see source
Desired Result:true
Result:true

Testing parent and ancestor ops
Test:see source
Desired Result:true
Result:true

Testing basic xsl:apply-templates
Test:<xsl:apply-templates/>
Desired Result:element x, element y, element z
Result: ,element x ,element y ,element z

Testing basic xsl:apply-templates with mode
Test:<xsl:apply-templates mode="mode-test"/>
Desired Result:x, y, z
Result:, x, y, z

Testing predicates
Test:see source
Desired Result: z
Result: z

Testing predicates
Test:see source
Desired Result:
Result:

Named Template/Call Template

Test:<xsl:call-template name="named-template-test"/>
Desired Result:named template processed with default value!
Result:named template processed with default value!

Test:- passing arguments to named templates (see xsl source)
Desired Result:named template processed with passed value!
Result:named template processed with passed value!

Attribute Value Templates and variables
Test:

Desired Result: Red Text
Result: Red Text


Axis Identifiers (these should work, I need more test cases though)
Test: <xsl:if test="descendant::z">true</xsl:if>
Desired Result: true
Result: true
Test: <xsl:if test="not(descendant-or-self::no-element)">true</xsl:if>
Desired Result: true
Result: true

Creating Elements with xsl:element and xsl:attribute
Test: <xsl:element name="FONT">
<xsl:attribute name="COLOR">blue</xsl:attribute>
Passed
</xsl:element>
Desired Result: Passed
Result: Passed
Using Attribute Sets
Test: <FONT xsl:use-attribute-sets="style1">
Passed
</FONT>
Desired Result: Passed
Result: Passed
Test: <xsl:element name="FONT" use-attribute-sets="style1 style2">
Passed
</xsl:element>
Desired Result: Passed
Result: Passed

Numbering (only simple numbering currently implemented)
Test: <xsl:number value="4"/>
Desired Result: 4
Result: 4
Test: see source
Desired Result: 1. x
1. y
1. z

Result: 1. x
1. y
1. z

Additive Expressions
Test: <xsl:value-of select="70+4"/>
Desired Result: 74
Result: 74
Test: <xsl:value-of select="-70+4"/>
Desired Result: -66
Result: -66
Test: <xsl:value-of select="1900+70+8-4"/>
Desired Result: 1974
Result: 1974
Test: <xsl:value-of select="(4+5)-(9+9)"/>
Desired Result: -9
Result: -9

Multiplicative Expressions
Test: <xsl:value-of select="7*4"/>
Desired Result: 28
Result: 28
Test: <xsl:value-of select="7mod4"/>
Desired Result: 3
Result: 3
Test: <xsl:value-of select="7div4"/>
Desired Result: 1.75
Result: 1.75
Test: <xsl:value-of select="7div0"/>
Desired Result: Infinity
Result: Infinity
Test: <xsl:value-of select="0 div 0"/>
Desired Result: NaN
Result: NaN
Test: <xsl:variable name="x" select="7*3"/>
<xsl:variable name="y" select="3"/>
<xsl:value-of select="$x div $y"/>
Desired Result: 7
Result: 7
Precedence tests
Test: <xsl:value-of select="2 mod 2 = 0"/>
Desired Result: true
Result: true
Test: <xsl:value-of select="5 mod 2<5 and 2*6>= 12"/>
Desired Result: true
Result: true
Test: <xsl:value-of select="5 mod 2<5 and 2*6>12"/>
Desired Result: false
Result: false
Test: <xsl:value-of select="4+5*3"/>
Desired Result: 19
Result: 19
Test: <xsl:value-of select="4+5*3+(6-4)*7"/>
Desired Result: 33
Result: 33
Automatic Result Type Conversion
Test: <xsl:value-of select="'747' + 8"/>
Desired Result: 755
Result: 755