Previous | Next | Indexes
Zvon > Tutorials > XSLT 2.0 Tutorial > Errors (2/6) >

Type errors

Type errors occur when a value submitted to an operation is not permitted for this operation.

XSLT

      <xsl:stylesheet
                  xmlns:sch="http://www.w3.org/2001/XMLSchema"
                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  version="2.0"
                  exclude-result-prefixes=" sch">
            <xsl:output  method="xml"
                        indent="yes"
                        omit-xml-declaration="yes"/>

            <xsl:template  match="/aaa">
                  <xsl:apply-templates  select="(1,2,3)"/>
                  <xsl:value-of  select="'a' + 'b'"/>
                  <xsl:variable  name="a"
                              select="2.34"
                              as="sch:integer"/>
                  <xsl:value-of  select="$a"/>
            </xsl:template>

      </xsl:stylesheet>
XML

      <aaa/>
Output

Error:


error - XTTE0520
Required item type of @select attribute of xsl:apply-templates is node(); supplied value has item type xs:integer

error - XPTY0004
Unsuitable operands for arithmetic operation (xs:string, xs:string)

error - XTTE0570
Required item type of value of variable $a is xs:integer; supplied value has item type xs:decimal


Failed to compile stylesheet. 3 errors detected.


Previous chapter: Built in Types
Next chapter: Use When
Previous page: Static errors
Next page: Dynamic errors