Re: [xslt] exslt functions problem



Hi,

It turned out that Apache was a red herring with this problem; the
problems occur (whether using Apache or from the command-line) when
I try to import a file containing a function into a second file, then
call that function from the second file. I'm not sure if the problem
is that I'm misunderstanding how namespaces work, or something else.

Given the two files below, if I run the second one free-standing
everything works fine (though I found I needed to include the
line
extension-element-prefixes="func"
which I thought shouldn't be necessary - I don't know if this is related).

If I call the second file from the first, it fails with the error
messages:
>
xmlXPathCompOpEval: function testfunc not found
Error xpath.c:9306: Unregistered function
xmlXPathCompiledEval: evaluation failed
runtime error: file test2.xsl element value-of
xsltValueOf: text copy failed

When I put a fprintf in libxml hash.c xmlHashAddEntry3() to show the
values name, name2, name3 being passed for registering I see among other
things: 
http://exslt.org/functions,(null),(null)
http://opencollector.org/functions,testfunc,(null)

so it does appear to be registered.
Changing the namespace so that my function is in the 'func' namespace
instead of 'ocfunc' doesn't change anything.

Can anyone tell me what I'm doing wrong?
Thanks
Graham

----------------------------------------------------------------
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0"
xmlns:ocfunc="http://opencollector.org/functions";
>
<xsl:import href="test.xsl"/>

<xsl:template match="/">
 <xsl:value-of select="ocfunc:testfunc()"/>
</xsl:template>

</xsl:stylesheet>
-------------------------------------------------------------------------
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0"
xmlns:func="http://exslt.org/functions";
xmlns:ocfunc="http://opencollector.org/functions";
extension-element-prefixes="func"
>

<func:function name="ocfunc:testfunc">
  <func:result select="99"/>
</func:function>

<xsl:template match="/">
 <xsl:value-of select="ocfunc:testfunc()"/>
</xsl:template>

</xsl:stylesheet>
---------------------------------------------------------------------------




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