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: | - - - |