Re: [xslt] Problems using functions with xsl



Hi,

Sorry... you're right - the error message was not exactly related with the xsl file I sent. The error message was reporting an error in line 14.

I'm doing the following program in C++:

xsltStylesheetPtr XMLStyleSheetPtr = NULL;
XMLStyleSheetPtr = xsltParseStylesheetFile((const xmlChar *)xsltFileName);
exsltRegisterAll();
xmlDocPtr XMLDocumentPtr = xsltApplyStylesheet (XMLStyleSheetPtr, XMLDocumentPtr, NULL);


This will apply the given stylesheet to a simple xml doc. I get the referred error message:

xmlXPathCompOpEval: function testparam not found
XPath error : Unregistered function
xmlXPathCompiledEval: evaluation failed
runtime error: file file:///c%3A/temp/xml/prueba.xsl line 14 element value-of
xsltValueOf: text copy failed


Kind regards,

Pedro

From: "William M. Brack" <wbrack mmm com hk>
Reply-To: The Gnome XSLT library mailing-list <xslt gnome org>
To: "The Gnome XSLT library mailing-list" <xslt gnome org>
Subject: Re: [xslt] Problems using functions with xsl
Date: Tue, 9 Nov 2004 00:23:28 +0800 (HKT)

Pedro Rocha said:
> Hi,
>
> I'm having problems using the extention functions with xsl.
>
> I've got the following error messages:
>
> xmlXPathCompOpEval: function testparam not found
> XPath error : Unregistered function
> xmlXPathCompiledEval: evaluation failed
> runtime error: file file:///c%3A/temp/xml/prueba.xsl line 234 element
> value-of
> xsltValueOf: text copy failed
>
> This is the xsl file:
> --------------------------------------------
> <?xml version='1.0'?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> xmlns:func="http://exslt.org/functions";
> extension-element-prefixes="func"
> version="1.0">
>
> <func:function name="func:testparam">
> <xsl:param name="foo" select="'Test'"/>
> <xsl:param name="bar" select="concat($foo, ' succeeded')"/>
> <func:result select="$bar"/>
> </func:function>
>
> <xsl:template match="/">
> <xsl:value-of select="func:testparam()" />
> </xsl:template>
> </xsl:stylesheet>
> ---------------------------------------------
>
> I had a similar problem when I was trying to use the exslt str functions...
> it was because i didn't call the function exsltRegisterAll();
>
> Any clue?
>
> Thanks,
>
> Pedro


First, I really don't understand your error message - it says there was
trouble on line 234, but your posted stylesheet has less than 20 lines.

Second, when I try your posted stylesheet with the current release of
xsltproc, it seems to work with no problem:

wbrack bbrack work $ xsltproc --version
Using libxml 20615, libxslt 10109 and libexslt 807
xsltproc was compiled against libxml 20615, libxslt 10109 and libexslt 807
libxslt 10109 was compiled against libxml 20615
libexslt 807 was compiled against libxml 20615
wbrack bbrack work $ xsltproc bug.xsl bug.xsl
<?xml version="1.0"?>
Test succeeded

Could you please be more clear on this report?

Thanks,
Bill

_______________________________________________
xslt mailing list, project page http://xmlsoft.org/XSLT/
xslt gnome org
http://mail.gnome.org/mailman/listinfo/xslt

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.com/




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