X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Frecord_conv.c;h=0ec4f13607f46d56c85e5592d09323b8d84270ba;hb=828e4c72181fb748b1f12072351f4cd3e5be4dd5;hp=dbca156ad8905bcc4b7baf4fa3164c1d55669aea;hpb=d0c99a160417bc4064050d23140516194352671c;p=yaz-moved-to-github.git diff --git a/src/record_conv.c b/src/record_conv.c index dbca156..0ec4f13 100644 --- a/src/record_conv.c +++ b/src/record_conv.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2010 Index Data + * Copyright (C) 1995-2011 Index Data * See the file LICENSE for details. */ /** @@ -177,7 +177,7 @@ static int conv_xslt(yaz_record_conv_t p, const xmlNode *ptr) { wrbuf_printf(p->wr_error, "Element :" " could not locate stylesheet '%s'", - stylesheet, fullpath); + stylesheet, stylesheet); if (p->path) wrbuf_printf(p->wr_error, " with path '%s'", p->path); @@ -192,7 +192,9 @@ static int conv_xslt(yaz_record_conv_t p, const xmlNode *ptr) wrbuf_printf(p->wr_error, " with path '%s'", p->path); return -1; } - xsp = xsltParseStylesheetDoc(xsp_doc); + /* need to copy this before passing it to the processor. It will + be encapsulated in the xsp and destroyed by xsltFreeStylesheet */ + xsp = xsltParseStylesheetDoc(xmlCopyDoc(xsp_doc, 1)); if (!xsp) { wrbuf_printf(p->wr_error, "Element: :" @@ -207,14 +209,15 @@ static int conv_xslt(yaz_record_conv_t p, const xmlNode *ptr) "EXSLT not supported" #endif ")"); + xmlFreeDoc(xsp_doc); return -1; } else { struct yaz_record_conv_rule *r = add_rule(p, YAZ_RECORD_CONV_RULE_XSLT); - r->u.xslt.xsp_doc = xmlCopyDoc(xsp_doc, 1); - xsltFreeStylesheet(xsp); /* will free xsp_doc */ + r->u.xslt.xsp_doc = xsp_doc; + xsltFreeStylesheet(xsp); } } return 0;