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:
Testing xsl:if
Test: <xsl:if test="x | y | z">true</xsl:if>
Desired Result: true
Result:
Testing xsl:if
Test: <xsl:if test="true()">true</xsl:if>
Desired Result: true
Result:
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:
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:
Testing xsl:choose
Test:see source
Desired Result: true
Result:
Testing parent and ancestor ops
Test:see source
Desired Result: true
Result:
Testing basic xsl:apply-templates
Test:<xsl:apply-templates/>
Desired Result:element x, element y, element z
Result:
Testing basic xsl:apply-templates with mode
Test:<xsl:apply-templates mode="mode-test"/>
Desired Result:x, y, z
Result:
Testing predicates
Test:see source
Desired Result: z
Result:
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:
Test: - passing arguments to named templates (see xsl source)
Desired Result:named template processed with passed value!
Result:
Attribute Value Templates and variables
Test:
Axis Identifiers (these should work, I need more test cases though) | |
Test: |
<xsl:if test="descendant::z">true</xsl:if> |
Desired Result: |
true |
Result: |
|
Test: |
<xsl:if test="not(descendant-or-self::no-element)">true</xsl:if> |
Desired Result: |
true |
Result: |
|
Test: |
<xsl:value-of select="count(x/attribute::*)"/> |
Desired Result: |
1 |
Result: |
|
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: |
|
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: |
|
Numbering (only simple numbering currently implemented) | |
Test: |
<xsl:number value="4"/> |
Desired Result: |
4 |
Result: |
|
Test: |
see source |
Desired Result: |
1. x 1. y 1. z |
Result: |
|
Additive Expressions | |
Test: |
<xsl:value-of select="70+4"/> |
Desired Result: |
74 |
Result: |
|
Test: |
<xsl:value-of select="-70+4"/> |
Desired Result: |
-66 |
Result: |
|
Test: |
<xsl:value-of select="1900+70+8-4"/> |
Desired Result: |
1974 |
Result: |
|
Test: |
<xsl:value-of select="(4+5)-(9+9)"/> |
Desired Result: |
-9 |
Result: |
|
Multiplicative Expressions | |
Test: |
<xsl:value-of select="7*4"/> |
Desired Result: |
28 |
Result: |
|
Test: |
<xsl:value-of select="7mod 4"/> |
Desired Result: |
3 |
Result: |
|
Test: |
<xsl:value-of select="7div 4"/> |
Desired Result: |
1.75 |
Result: |
|
Test: |
<xsl:value-of select="7div 0"/> |
Desired Result: |
Infinity |
Result: |
|
Test: |
<xsl:value-of select="0 div 0"/> |
Desired Result: |
NaN |
Result: |
|
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: |
|
Precedence tests | |
Test: |
<xsl:value-of select="2 mod 2 = 0"/> |
Desired Result: |
true |
Result: |
|
Test: |
<xsl:value-of select="5 mod 2 < 5 and 2*6 >= 12"/> |
Desired Result: |
true |
Result: |
|
Test: |
<xsl:value-of select="5 mod 2 < 5 and 2*6>12"/> |
Desired Result: |
false |
Result: |
|
Test: |
<xsl:value-of select="4+5*3"/> |
Desired Result: |
19 |
Result: |
|
Test: |
<xsl:value-of select="4+5*3+(6-4)*7"/> |
Desired Result: |
33 |
Result: |
|
Automatic Result Type Conversion | |
Test: |
<xsl:value-of select="'747' + 8"/> |
Desired Result: |
755 |
Result: |
|