RE: [xsl] Required item type of first argument of <function> is node(); supplied value has item type xs:string

Subject: RE: [xsl] Required item type of first argument of <function> is node(); supplied value has item type xs:string
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 19 Feb 2010 22:08:36 -0000
> I'm creating a function (so using 2.0), and this function 
> should be generic enough to handle pretty much anything I 
> throw at it, so I set the param type as node(). Trouble pops 
> up though when I call a function such as the upper-case() 
> xslt function on the parameter being passed in, as it's a 
> string now, not a node.
> 

You've simplified the code to illustrate the problem, which is fine, but
sometimes when people submit a problem like this I like to stand back and
think: what are you actually trying to achieve? What is the problem to which
this rather convoluted code is perceived as the solution? As far as I can
see, you are trying to make one function do too much. It doesn't feel right
to me that a function that navigates to descendent nodes when given a node,
should also do something useful if given a string. Sure, you can do it, but
is there a better design?

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 

Current Thread