Subject: Re: [xsl] xsltproc/LibXSLT - non-compliance?|
From: Michael Ludwig <mlu@xxxxxxxxxxxxx>
Date: Wed, 30 Apr 2008 17:56:00 +0200
In this case, LibXSLT is, indeed, not in compliance.
That is not at all clear to me. The wording of these things is a lot tighter in xpath2 so it's clearer to be definite there, but in xslt 1, then it is not the case that . (evaluating to a node) matches the description "The argument must evaluate to a string that is a QName."
Well, in this case the argument *does* evaluate to a string that is a QName. It consequently matches the quoted description.
I agree a node-set isn't bound to evaluate to a QName-conforming string. But that doesn't seem to be what the processor is interested in. It all happens at runtime. There is no compile-time checking going on with respect to the invocation of element-available(). And we do get a runtime error, where the argument could have been evaluated to a string representing a QName.
The xpath1 string functions that take strings also take a node set, in which case the string value of the first node in document order is taken, but that is (I think) a feature of the function, rather than a general calling rule, the rule is given in section 4.2 of the xpath spec, but the definition of function-available in the xslt spec does not reference that section explictly or implictly (as it could have done by using the defined term "string function").
Okay, I think I get it now. Your point is that the automatic conversion business is defined in XPath 1.0, which the part of XSLT 1.0 that is in question here does not reference, and that hence automatic conversion rules cannot legitimately be expected to work for element-available() and function-available(). Is this interpretation of your words correct?
And your statement is corroborated by the fact that, among others, the definition of key() explicitly states:
When the second argument to key is of any other type, the argument is converted to a string as if by a call to the string function [http://www.w3.org/TR/xpath#function-string] -- http://www.w3.org/TR/xslt#key
And the definitions of element-available() and function-available() don't say that much, so you can't rely on automatic conversion to just happen.