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



On Tue, Mar 24 2009 09:50:05 +0000, mlu as-guides com wrote:
> Viktor Stujber schrieb:
>> 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.
>
> First, the error message strongly suggests you haven't bound the prefix
> "date" to a namespace. As a consequence, the XPath expression cannot be
> compiled.

The other thing to check is that the namespace prefix is also used in
the value of the "extension-element-prefixes" attribute of
xsl:stylesheet [1].  It's a quirk of libxslt that you need to register
namespaces for extension functions this way.

Regards,


Tony Graham                         Tony Graham MenteithConsulting com
Director                                  W3C XSL FO SG Invited Expert
Menteith Consulting Ltd
XML, XSL and XSLT consulting, programming and training
Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
Registered in Ireland - No. 428599   http://www.menteithconsulting.com
  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
xmlroff XSL Formatter                               http://xmlroff.org
xslide Emacs mode                  http://www.menteith.com/wiki/xslide
Unicode: A Primer                               urn:isbn:0-7645-4625-2


[1] http://www.xmlsoft.org/XSLT/extensions.html#Keep


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