Previous | Next | Indexes
adultinternetusers > Tutorials > XSLT 2.0 Tutorial > Stylesheet Functions (11/11) >

Mismatch in types of parameters and arguments

If types of function call arguments does not correspond to expected types of parameters of a function, a fatal error results.

XSLT

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

            <xsl:function  name="my:return-number">
                  <xsl:param  name="a"
                              as="sch:string"/>
                  <xsl:param  name="b"
                              as="sch:double"/>
                  <xsl:value-of  select="$a"/>
                  <xsl:text>: </xsl:text>
                  <xsl:value-of  select="$b"/>
            </xsl:function>

            <xsl:template  match="/aaa">
                  <xxx>
                        <xsl:copy-of  select="my:return-number(23,'Number')"/>
                  </xxx>
            </xsl:template>

      </xsl:stylesheet>
XML

      <aaa/>
Output

Error:


error - XPTY0004
Required item type of first argument of my:return-number() is xs:string; supplied value has item type xs:integer


Failed to compile stylesheet. 1 error detected.


Previous chapter: Variables and Parameters
Next chapter: Comparisons
Previous page: Types of parameters
Next page: - - -

Kevin Carr in Stanton

Natural Skin Care and European Soaps
Kevin Carr
Mayor Dave Shawver Stanton
Internetusers


You can also get Organic Skin Care products from Bliss Bath Body and you must check out their Natural Body Lotions and bath soaps

Now if you are looking for the best deals on surf clothing from Quiksilver and Roxy then you have to check these amazing deals here:

Hey, check out this Organic Skin Care European Soaps along with Natural Lavender Body Lotion and shea butter

and we can get surf t shirts surfing shirt and And you must check out this website swim suit swimming suit and swim trunks