Re: [xslt] concat fails with zero or one parameter



William Krick wrote:
> The concat function doesn't work with zero or one parameter
> 
> According to the w3 spec...
> 
> http://www.w3.org/TR/2002/WD-xquery-operators-20020816/#func-concat
> 
> ...these should be valid....
> 
> <xsl:value-of select="concat()" />
> <xsl:value-of select="concat('abc')" />
> 
> Is this a known bug or am I interpreting the spec wrong?

You're not misinterpreting the spec you refer to, but that's XPath 2.0,
not XPath 1.0.  If you follow the [XPath 1.0] link in the document you
refer to, you will see that there concat() is specified as

Function: string concat(string, string, string*)

The concat function returns the concatenation of its arguments.

Which clearly suggests a minimum of 2 arguments is required.
It is odd that the XPath 2.0 document suggests that the
0-or-more-arguments system is used for compatibility with XPath 1.0;
perhaps they originally considered making it a 2-argument function,
but decided to make it fully variadic instead.

In any case, in XSLT 1.0 (which is the version supported by libxslt),
the two examples you provide are indeed not valid.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]