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
"http://exslt.org/functions";, 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"
  xmlns:str="http://exslt.org/strings";
  xmlns:date="http://exslt.org/dates-and-times";
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

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

  <xsl:output indent="yes"/>

  <xsl:template match="/*">
    <xsl:copy>
      <xsl:apply-templates/>
      <!-- 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'"/>
      <str>
        <xsl:value-of select="str:replace( $date, ' ', 'T')"/>
      </str>
      <formatted>
        <xsl:value-of select="
          date:format-date( str:replace( $date, ' ', 'T'), $fmt)"/>
      </formatted>
    </xsl:copy>
  </xsl:template>

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

</xsl:stylesheet>

m...@flunder:~/win-c/MILU/dev/XSLT-1 > cat urmel.xml
<Urmel/>

m...@flunder:~/win-c/MILU/dev/XSLT-1 > xsltproc exslt.xsl urmel.xml
<?xml version="1.0"?>
<Urmel>
  <str>2009-03-23T10:21:00</str>
  <formatted>10:21:00 | 23. March, 09</formatted>
</Urmel>
_______________________________________________
xslt mailing list, project page http://xmlsoft.org/XSLT/
[email protected]
http://mail.gnome.org/mailman/listinfo/xslt

Reply via email to