RE: [xsl] xsl:function

Subject: RE: [xsl] xsl:function
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Sat, 10 May 2003 16:59:42 +0100
> Just wanted to drop a note saying that the Saxon 7.5 
> implementation looks good. One thing that did occur to me -- 
> with the ability to specify data types now an intrinsic part 
> of the language, I wonder if the two functions
>  <xsl:function name="ol:func">
>   <xsl:param name="arg1" as="xs:integer"/>
>   <h1>This is an integer</h1>
>  </xsl:function>
>  <xsl:function name="ol:func">
>   <xsl:param name="arg1" as="xs:string"/>
>   <h1>This is a string</h1>
>  </xsl:function>

As Jeni pointed out, the current XPath model doesn't allow two functions
with the same name and arity. In fact, the current Saxon implementation
doesn't yet allow two functions with the same name and *different*

In principle the XPath function calling rules could be extended to
handle polymorphic functions, but this would require some careful
consideration of the rules for (a) untyped data as arguments, and (b)
atomization (what if one function accepts a node, and the other an

The XQuery people, however, are quite keen *not* to allow function
binding based on the dynamic types of the arguments. It makes it much
harder to do compile-time optimization, which is so important when
selecting efficient access paths in large databases.

Michael Kay

 XSL-List info and archive:

Current Thread