[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] [XPath 3.0] Partial function application plus arity?

Subject: Re: [xsl] [XPath 3.0] Partial function application plus arity?
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Tue, 06 Nov 2012 23:27:26 +0000

Now, I would like to provide concat() a value for the first argument and leave undefined two arguments. So I tried this:

XPath #4
let $concat3 := concat#3('Section') return $concat3(': ', 1)

But that generates this error:

    Required item type of target of dynamic
    function call is function(); supplied value
    has item type xs:string

What is that error message saying?

I suspect the processor has decided that $concat3 will always be a string (because the result of concat#3 is always a string), and you can't do X(y,z) if X is a string.

This is what Saxon (9.4) says, which I hope is more helpful:

XPTY0004: Error in dynamic function call. Number of arguments required = 3; number supplied = 1

Saxon is complaining here about concat#3('Section') - concat#3 expects three arguments (or place-holders) and you've only supplied one.

What is the correct way of expressing the desired XPath?

let $concat3 := concat#3('Section', ?, ?) return $concat3(': ', 1)

Michael Kay

Current Thread