Check for xsltSaveResultToString presence.
authorAdam Dickmeiss <adam@indexdata.dk>
Fri, 26 May 2006 15:07:08 +0000 (15:07 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Fri, 26 May 2006 15:07:08 +0000 (15:07 +0000)
buildconf.sh
src/record_conv.c

index 378aeb9..aeb6d5e 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: buildconf.sh,v 1.36 2006-05-25 13:03:35 mike Exp $
+# $Id: buildconf.sh,v 1.37 2006-05-26 15:07:08 adam Exp $
 
 automake=automake
 aclocal=aclocal
@@ -26,7 +26,8 @@ fi
 
 set -x
 # I am tired of underquoted warnings for Tcl macros
-$aclocal -I m4 2>&1 | grep -v "warning: underquoted definition"
+#$aclocal -I m4 2>&1 | grep -v "warning: underquoted definition"
+$aclocal -I m4
 $libtoolize --automake --force 
 $automake --add-missing 
 $autoconf
index 4f153a9..94447f5 100644 (file)
@@ -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);