[xslt] confusing error message "function format-date bound to undefined prefix date"



Greetings. We had some trouble when modifying our presentation layer
to use (e)xslt date formatting. The problematic code looked like this:

<xsl:value-of select="date:format-date(str:replace($date, ' ', 'T'),
'HH:mm:ss | dd. MMMM, yy')"/>

This line worked on its author's test setup, which used an older
libxslt version. But when deployed on our webserver, it started
throwing errors:

xmlXPathCompOpEval: function format-date bound to undefined prefix date
xmlXPathCompiledEval: 1 objects left on the stack.

The author of this line didn't realize how str:replace works and what
its return type is. This function returns a node-set, not a simple
string. It's possible that the earlier libxslt version didn't check
the types or such.

Anyway, the thing I want to point out is that in case of such a
mistake, the error message that gets printed is not helpful at all,
and I suggest checking why exactly libxslt prints such an incorrect
error.


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