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

Tony Graham schrieb:
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.

I wonder if you really do in this example, except of course for
"";, which indeed provides an extension
*element*, namely <func:function>, whereas in the scope of this
example stylesheet module, we're only using extension *functions*,
and the attribute is *not* called "extension-function-prefixes".

So I think you have to do this for extension elements, but not for
extension functions, although it doesn't seem to hurt either.

The following works fine with libxml 20702, libxslt 10124, libexslt 813.

Note the prefixes str: and date: are not declared as extension element
prefixes. I can even delete their declaration as extension element
prefixes in the included file and it still works. The only thing I
cannot drop as an extension element prefix is "func:".

Michael Ludwig

<xsl:stylesheet version="1.0"

  <xsl:include href="date.format-date.function.xsl"/>

  <xsl:output indent="yes"/>

  <xsl:template match="/*">
      <!-- add two elements -->
      <xsl:variable name="date" select="'2009-03-23 10:21:00'"/>
      <xsl:variable name="fmt"  select="'HH:mm:ss | dd. MMMM, yy'"/>
        <xsl:value-of select="str:replace( $date, ' ', 'T')"/>
        <xsl:value-of select="
          date:format-date( str:replace( $date, ' ', 'T'), $fmt)"/>

  <xsl:template match="@*|node()">
      <xsl:apply-templates select="@*|node()"/>


MiLu FLUNDER:~/win-c/MILU/dev/XSLT-1 > cat urmel.xml

MiLu FLUNDER:~/win-c/MILU/dev/XSLT-1 > xsltproc exslt.xsl urmel.xml
<?xml version="1.0"?>
  <formatted>10:21:00 | 23. March, 09</formatted>

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