X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Frecord_conv.c;h=c644c7d0d4ec8e71fc0fc8905aa03a8faeadda51;hp=dbca156ad8905bcc4b7baf4fa3164c1d55669aea;hb=43a9d38d20c1b1bcd1a03b2445a501d27526bd35;hpb=d0c99a160417bc4064050d23140516194352671c diff --git a/src/record_conv.c b/src/record_conv.c index dbca156..c644c7d 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. */ /** @@ -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;