X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Frecord_conv.c;h=94447f5ec02af4f127f3fe3f8b4cce47011627eb;hp=4f153a90c3c9662647c6d2b84c2aa9dc23421a1b;hb=6bf59f76b5de3421afc0accae54d0829586398a8;hpb=534fdfbf5a8c27f4695c1b73be5636e369ca1acc diff --git a/src/record_conv.c b/src/record_conv.c index 4f153a9..94447f5 100644 --- a/src/record_conv.c +++ b/src/record_conv.c @@ -2,7 +2,7 @@ * Copyright (C) 2005-2006, Index Data ApS * See the file LICENSE for details. * - * $Id: record_conv.c,v 1.9 2006-05-25 07:43:58 adam Exp $ + * $Id: record_conv.c,v 1.10 2006-05-26 15:07:08 adam Exp $ */ /** * \file record_conv.c @@ -440,21 +440,33 @@ int yaz_record_conv_record(yaz_record_conv_t p, xmlDocPtr res = xsltApplyStylesheet(r->u.xslt.xsp, doc, 0); if (res) { - xmlChar *out_buf; + xmlChar *out_buf = 0; int out_len; +#if HAVE_XSLTSAVERESULTTOSTRING xsltSaveResultToString(&out_buf, &out_len, res, r->u.xslt.xsp); - - wrbuf_rewind(record); - wrbuf_write(record, (const char *) out_buf, out_len); - - xmlFree(out_buf); +#else + xmlDocDumpFormatMemory (res, &out_buf, &out_len, 1); +#endif + if (!out_buf) + { + wrbuf_printf(p->wr_error, + "xsltSaveResultToString failed"); + ret = -1; + } + else + { + wrbuf_rewind(record); + wrbuf_write(record, (const char *) out_buf, out_len); + + xmlFree(out_buf); + } xmlFreeDoc(res); } else { - wrbuf_printf(p->wr_error, "xsltApplyStylesheet faailed"); + wrbuf_printf(p->wr_error, "xsltApplyStylesheet failed"); ret = -1; } xmlFreeDoc(doc);