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

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.

Chidanand Gangur

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