Re: [xsl] function overloads

Subject: Re: [xsl] function overloads
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 21 Mar 2011 14:22:36 +0000
On 21/03/2011 14:12, Merrilees, David wrote:
Hi

I've defined a function than created an overload:

<xsl:function name="f:action-form" as="element()">
         <xsl:param name="id" as="xs:string" />
         <xsl:param name="actionName" as="xs:string" />
         <xsl:param name="controllerName" as="xs:string" />
         <xsl:param name="method" as="xs:string"/>
         <xsl:param name="routeValues" as="node()" />
         <xsl:apply-templates select="html:action-form($Html, $id, if (string-length($method)&gt; 0) then $method else 'post', $actionName, $controllerName, f:list($routeValues))" mode="helper"/>
</xsl:function>

<xsl:function name="f:action-form" as="element()">
         <xsl:param name="id" as="xs:string" />
         <xsl:param name="actionName" as="xs:string" />
         <xsl:param name="controllerName" as="xs:string" />
         <xsl:param name="method" as="xs:string" />
         <xsl:apply-templates select="html:action-form($Html, $id, if (string-length($method)&gt; 0) then $method else 'post', $actionName, $controllerName)" mode="helper"/>
</xsl:function>

When I run the transform, I get the following static error:

{"Required item type of 5th argument of html:action-form() is element(); supplied value has item type xs:string"}

I don't understand this; the functions are not executed anywhere. Am I missing something?

Thanks


ypur two overloads have 5 and 4 parameters but the calls have 6 and 5 parameters.


If you call the second, 4 parameter form then in the recursive call it uses 5 parameters, the last of which is the string $controllername. but teh 5th param of teh 5 parameter form is the node routValues.


David


________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. ________________________________________________________________________


Current Thread