Re: [xml] xsltApplystylesheet fails when Xpath functions are use in xsl


-----Original Message-----
From: xml-bounces gnome org [mailto:xml-bounces gnome org] On 

I have following code

int main()

    xmlDocPtr doc = xmlParseFile("xmlfile.xml");
    xsltStylesheetPtr xsl=xsltParseStylesheetFile("xslfile.xsl");
    xmlDocPtr result = xsltApplyStylesheet(xsl, doc, NULL);

    xmlSaveFile("stylesheet_output.xml", result);

    return 0;

The program work fine when my xsl do not use any of the XPath 
functions. I have a use case where I need  to replace all the 
single quotes with double single quotes. To achive this i 
wrote a xsl where i used XPath "replace" function. the 
program fails giving following output

xmlXPathCompOpEval: function replace not found
XPath error Unregistered function in replace($VAR1, $QUOTE, $DQUOTE)
xmlXPathCompiledEval: 2 object left on the stack
runtime error: file xslfile.xsl element value-of

the same xml when opened in browser gives me correct output.

I also tried using xsltproc this too gives the same error as 
shown above.

Can some one tell me the reason for this behavior.

You may want to use the EXSLT function "replace", since there
is no XPath or XSLT 1.0 function with that name.


Register the EXSLT function for Libxslt with exsltRegisterAll().



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