X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=recctrl%2Falvis.c;h=ec22ed700d7e5a04986755123d7be04ab06fd356;hb=66eb724d4e68e942529f4d356daa8b888a51d8c0;hp=7e9aa76b967692a604eb7545b31c4cc9232bbadd;hpb=a92a4f15b3e570c055590166ae91f497e61cd949;p=idzebra-moved-to-github.git diff --git a/recctrl/alvis.c b/recctrl/alvis.c index 7e9aa76..ec22ed7 100644 --- a/recctrl/alvis.c +++ b/recctrl/alvis.c @@ -1,4 +1,4 @@ -/* $Id: alvis.c,v 1.13 2006-05-24 08:23:01 marc Exp $ +/* $Id: alvis.c,v 1.15 2006-05-24 18:31:33 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -208,6 +208,11 @@ static ZEBRA_RES create_schemas(struct filter_info *tinfo, const char *fname) attr_content(attr, "default", &schema->default_schema); attr_content(attr, "snippet", &schema->include_snippet); } + /*yaz_log(YLOG_LOG, "XSLT add %s %s %s", + schema->name, schema->identifier, schema->stylesheet); */ + + /* find requested schema */ + if (schema->stylesheet) schema->stylesheet_xsp = xsltParseStylesheetFile( @@ -237,19 +242,20 @@ static struct filter_schema *lookup_schema(struct filter_info *tinfo, const char *est) { struct filter_schema *schema; + for (schema = tinfo->schemas; schema; schema = schema->next) - { + { /* find requested schema */ if (est) - { + { if (schema->identifier && !strcmp(schema->identifier, est)) - return schema; + return schema; + if (schema->name && !strcmp(schema->name, est)) return schema; - } - + } /* or return default schema if defined */ - if (schema->default_schema) + else if (schema->default_schema) return schema; } @@ -650,20 +656,23 @@ static int filter_retrieve (void *clientData, struct recRetrieveCtrl *p) { xmlChar *buf_out; int len_out; - xmlDocDumpMemory(resDoc, &buf_out, &len_out); + + xsltSaveResultToString(&buf_out, &len_out, resDoc, + schema->stylesheet_xsp); p->output_format = VAL_TEXT_XML; p->rec_len = len_out; p->rec_buf = odr_malloc(p->odr, p->rec_len); memcpy(p->rec_buf, buf_out, p->rec_len); - xmlFree(buf_out); } else if (p->output_format == VAL_SUTRS) { xmlChar *buf_out; int len_out; - xmlDocDumpMemory(resDoc, &buf_out, &len_out); + + xsltSaveResultToString(&buf_out, &len_out, resDoc, + schema->stylesheet_xsp); p->output_format = VAL_SUTRS; p->rec_len = len_out;