Re: [xslt] Trouble with EXSLT 'function' element
- From: "William M. Brack" <wbrack mmm com hk>
- To: "The Gnome XSLT library mailing-list" <xslt gnome org>
- Subject: Re: [xslt] Trouble with EXSLT 'function' element
- Date: Mon, 17 Oct 2005 18:21:54 +0800 (HKT)
drkm said:
> Hi
>
> I have trouble with the EXSLT 'function' element. Here is a sample
> XSLT script that reproduces the problem :
>
> ~> cat nil-bugreport.xsl
> <?xml version="1.0"?>
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:func="http://exslt.org/functions"
> xmlns:my="..."
> extension-element-prefixes="my">
>
> <func:function name="my:identity">
> <xsl:param name="attr"/>
> <func:result select="$attr"/>
> </func:function>
>
> <xsl:template match="/">
> <xsl:message>
> <xsl:value-of select="my:identity('string')"/>
> </xsl:message>
> </xsl:template>
>
> </xsl:stylesheet>
>
> ~> xsltproc nil-bugreport.xsl nil.xml
> compilation error: file nil-bugreport.xsl line 10 element param
> element param only allowed within a template, variable or param
>
> ~> xsltproc --dumpextensions nil-bugreport.xsl nil.xml # excerpt
> ...
> Registered Extension Elements:
> {http://exslt.org/common}document
> {http://exslt.org/functions}result
> {http://xmlsoft.org/XSLT/}test
> ...
>
> So it seems the func:function element is not known. I use xsltproc
> on Cygwin:
>
> ~> xsltproc --version
> Using libxml 20620, libxslt 10114-CVS1011 and libexslt 812-CVS1011
> xsltproc was compiled against libxml 20620, libxslt 10114 and
> libexslt 812
> libxslt 10114 was compiled against libxml 20620
> libexslt 812 was compiled against libxml 20620
>
> Thanks for your help,
>
> --drkm
The extension-element-prefixes attribute on your stylesheet should include the
prefix 'func', i.e. extension-element-prefixes="my func". You might find it
useful to look at some of the examples in the 'tests/exslt/functions'
subdirectory of the libxslt distribution directory.
Bill
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]