MII TransforMiiX Test Cases

MITRE
MII TransforMiiX Test Cases

This document serves to test XPath and XSL functions.

Boolean Functions
Function: | boolean boolean( object )
Test: | <xsl:value-of select="boolean(descendant::z)"/>
Desired Result: | true
Result: | true
Test: | <xsl:value-of select="boolean(*)"/>
Desired Result: | true
Result: | true
Function: | boolean false()
Test: | <xsl:value-of select="false()"/>
Desired Result: | false
Result: | false
Function: | boolean true()
Test: | <xsl:value-of select="true()"/>
Desired Result: | true
Result: | true
Function: | boolean not( boolean )
Test: | <xsl:value-of select="not(true())"/>
Desired Result: | false
Result: | false

NodeSet Functions
Function: | number count( node-set )
Test: | <xsl:value-of select="count(*)"/>
Desired Result: | 4
Result: | 4
Function: | number position()
Test: | <xsl:value-of select="*[position()=3]"/>
Desired Result: | z
Result: | z
Function: | number last()
Test: | <xsl:value-of select="*[last()-1]"/>
Desired Result: | z
Result: | z
Function: | String local-name( node-set? )
Test: | <xsl:value-of select="local-name(names/abc:test-name)"/>
Desired Result: | test-name
Result: | test-name
Function: | String local-name( node-set? )
Test: | <xsl:value-of select="local-name()"/>
Desired Result: | document
Result: | document
Function: | String name( node-set? )
Test: | <xsl:value-of select="name(names/abc:test-name)"/>
Desired Result: | abc:test-name
Result: | abc:test-name
Function: | String namespace-uri( node-set? )
Test: | <xsl:value-of select="namespace-uri(names/abc:test-name)"/>
Desired Result: | abc
Result: | abc

String Functions
Function: | string string( object? )
Test: | <xsl:value-of select="string()"/>
Desired Result: | x y z
Result: | x y z
Test: | <xsl:value-of select="string('xyz')"/>
Desired Result: | xyz
Result: | xyz
Function: | string concat( string, string, string* )
Test: | <xsl:value-of select="concat('abc', 'def')"/>
Desired Result: | abcdef
Result: | abcdef
Function: | boolean contains( string, string )
Test: | <xsl:value-of select="contains('abcdef', 'efg')"/>
Desired Result: | false
Result: | false
Test: | <xsl:value-of select="contains('abcdef', 'bcd')"/>
Desired Result: | true
Result: | true
Function: | boolean starts-with( string, string )
Test: | <xsl:value-of select="starts-with('abcdef', 'abc')"/>
Desired Result: | true
Result: | true
Test: | <xsl:value-of select="starts-with('abcdef', 'xyz')"/>
Desired Result: | false
Result: | false
Function: | number string-length( string? )
Test: | <xsl:value-of select="string-length(name())"/>
Desired Result: | 8
Result: | 8
Test: | <xsl:value-of select="string-length('abcdef')"/>
Desired Result: | 6
Result: | 6
Function: | string substring( string, number, number? )
Test: | <xsl:value-of select="substring('12345', 1.5, 2.6)"/>
Desired Result: | 234
Result: | 234
Test: | <xsl:value-of select="substring('12345', 0, 3)"/>
Desired Result: | 12
Result: | 12
Test: | <xsl:value-of select="substring('12345', 0 div 0, 3)"/>
Desired Result: |
Result: |
Test: | <xsl:value-of select="substring('12345', 1, 0 div 0)"/>
Desired Result: |
Result: |
Test: | <xsl:value-of select="substring('12345', -42, 1 div 0)"/>
Desired Result: | 12345
Result: | 12345
Test: | <xsl:value-of select="substring('12345', -1 div 0, 1 div 0)"/>
Desired Result: |
Result: |
Function: | string substring-after( string, string )
Test: | <xsl:value-of select="substring-after('1999/04/01', '/')"/>
Desired Result: | 04/01
Result: | 04/01
Function: | string substring-before( string, string )
Test: | <xsl:value-of select="substring-before('1999/04/01', '/')"/>
Desired Result: | 1999
Result: | 1999
Function: | string translate( string, string, string )
Test: | <xsl:value-of select="translate('bar', 'abc', 'ABC')"/>
Desired Result: | BAr
Result: | BAr
Test: | <xsl:value-of select="translate('---aaa---', 'abc-', 'ABC')"/>
Desired Result: | AAA
Result: | AAA