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: Spencer Tickner <spencertickner@xxxxxxxxx>
Date: Fri, 19 Feb 2010 14:29:01 -0800
Appreciate the feedback. In the end what I'm really trying to do is
affect the capitalization of certain words. Whether our titles are all
upper-case (which is where the problem arose) or title-case some words
will always have special capitalization rules (example TransLink). I
was just attempting to centralize the storage and conversion of these
exception scenarios into a function that would be able to handle any
kind of title one would throw at it.

I'll keep pondering better ways of going about this.

Cheers,

Spencer

On Fri, Feb 19, 2010 at 2:08 PM, Michael Kay <mike@xxxxxxxxxxxx> wrote:
>>
>> 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