List Info

Thread: xsltApplystylesheet fails when Xpath functions are use in xsl




xsltApplystylesheet fails when Xpath functions are use in xsl
user name
2006-06-20 16:30:32
Hi,

> -----Original Message-----
> From: xml-bouncesgnome.org [mailtoml-bo
uncesgnome.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);
> 
>     xmlFreeDoc(doc);
>     xmlFreeDoc(result);
>     xsltFreeStylesheet(xsl);
>     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.

See http://www.exslt.org/str/functions/replace/index.html

Register the EXSLT function for Libxslt with
exsltRegisterAll().

Regards,

Kasimier
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )