This document serves to test XPath and XSLT functions.
    
      
        | 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 | 
    
    
      
        | Number Functions | 
      
        | Function: | number
           number(
          object?
          ) | 
      
        | Test: | <xsl:value-of select="number()"/> 
 | 
      
        | Desired Result: | NaN 
 | 
      
        | Result: | NaN | 
      
        | Test: | <xsl:value-of select="number('654.97')"/> 
 | 
      
        | Desired Result: | 654.97 
 | 
      
        | Result: | 654.97 | 
      
        | Function: | number
           round(
          number
          ) | 
      
        | Test: | <xsl:value-of select="round(1.75)"/> 
 | 
      
        | Desired Result: | 2 
 | 
      
        | Result: | 2 | 
      
        | Test: | <xsl:value-of select="round(1.25)"/> 
 | 
      
        | Desired Result: | 1 
 | 
      
        | Result: | 1 | 
      
        | Test: | <xsl:value-of select="round(-0.5)"/> 
 | 
      
        | Desired Result: | 0 
 | 
      
        | Result: | 0 | 
      
        | Test: | <xsl:value-of select="round(0.5)"/> 
 | 
      
        | Desired Result: | 1 
 | 
      
        | Result: | 1 | 
      
        | Function: | number
           floor(
          number
          ) | 
      
        | Test: | <xsl:value-of select="floor(2.2)"/> 
 | 
      
        | Desired Result: | 2 
 | 
      
        | Result: | 2 | 
      
        | Test: | <xsl:value-of select="floor(-2.2)"/> 
 | 
      
        | Desired Result: | -3 
 | 
      
        | Result: | -3 | 
      
        | Function: | number
           ceiling(
          number
          ) | 
      
        | Test: | <xsl:value-of select="ceiling(2.2)"/> 
 | 
      
        | Desired Result: | 3 
 | 
      
        | Result: | 3 | 
      
        | Test: | <xsl:value-of select="ceiling(-2.2)"/> 
 | 
      
        | Desired Result: | -2 
 | 
      
        | Result: | -2 |