projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Change yaz_filepath_resolve for path="" (empty)
[yaz-moved-to-github.git]
/
src
/
record_conv.c
diff --git
a/src/record_conv.c
b/src/record_conv.c
index
369a2e9
..
c644c7d
100644
(file)
--- a/
src/record_conv.c
+++ b/
src/record_conv.c
@@
-1,5
+1,5
@@
/* This file is part of the YAZ toolkit.
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2008 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* 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;
}
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: <xslt stylesheet=\"%s\"/>:"
if (!xsp)
{
wrbuf_printf(p->wr_error, "Element: <xslt stylesheet=\"%s\"/>:"
@@
-207,14
+209,15
@@
static int conv_xslt(yaz_record_conv_t p, const xmlNode *ptr)
"EXSLT not supported"
#endif
")");
"EXSLT not supported"
#endif
")");
+ xmlFreeDoc(xsp_doc);
return -1;
}
else
{
struct yaz_record_conv_rule *r =
add_rule(p, YAZ_RECORD_CONV_RULE_XSLT);
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;
}
}
return 0;
@@
-304,6
+307,12
@@
static int conv_marc(yaz_record_conv_t p, const xmlNode *ptr)
if (input_charset && !output_charset)
output_charset = "utf-8";
}
if (input_charset && !output_charset)
output_charset = "utf-8";
}
+ else if (!strcmp(output_format, "turbomarc"))
+ {
+ output_format_mode = YAZ_MARC_TURBOMARC;
+ if (input_charset && !output_charset)
+ output_charset = "utf-8";
+ }
else if (!strcmp(output_format, "marc"))
{
output_format_mode = YAZ_MARC_ISO2709;
else if (!strcmp(output_format, "marc"))
{
output_format_mode = YAZ_MARC_ISO2709;
@@
-472,7
+481,8
@@
static int yaz_record_conv_record_rule(yaz_record_conv_t p,
else
ret = -1;
}
else
ret = -1;
}
- else if (r->u.marc.input_format == YAZ_MARC_MARCXML)
+ else if (r->u.marc.input_format == YAZ_MARC_MARCXML ||
+ r->u.marc.input_format == YAZ_MARC_TURBOMARC)
{
xmlDocPtr doc = xmlParseMemory(wrbuf_buf(record),
wrbuf_len(record));
{
xmlDocPtr doc = xmlParseMemory(wrbuf_buf(record),
wrbuf_len(record));
@@
-525,7
+535,7
@@
static int yaz_record_conv_record_rule(yaz_record_conv_t p,
xmlChar *out_buf = 0;
int out_len;
xmlChar *out_buf = 0;
int out_len;
-#if YAZ_HAVE_XSLTSAVERESULTTOSTRING
+#if HAVE_XSLTSAVERESULTTOSTRING
xsltSaveResultToString(&out_buf, &out_len, res, xsp);
#else
xmlDocDumpFormatMemory (res, &out_buf, &out_len, 1);
xsltSaveResultToString(&out_buf, &out_len, res, xsp);
#else
xmlDocDumpFormatMemory (res, &out_buf, &out_len, 1);
@@
-576,6
+586,7
@@
void yaz_record_conv_set_path(yaz_record_conv_t p, const char *path)
/*
* Local variables:
* c-basic-offset: 4
/*
* Local variables:
* c-basic-offset: 4
+ * c-file-style: "Stroustrup"
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab