X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=recctrl%2Fxslt.c;h=6787510d478a003810ab6dce1f48205a5596730e;hb=ebcf2ad410ec9196eee698f021a1bfd6057bdc25;hp=a118277523758ae1215771644d4d860da9cb5e0c;hpb=bb90b19c6082e427d5c014e6751a095a37a20b6d;p=idzebra-moved-to-github.git diff --git a/recctrl/xslt.c b/recctrl/xslt.c index a118277..6787510 100644 --- a/recctrl/xslt.c +++ b/recctrl/xslt.c @@ -1,4 +1,4 @@ -/* $Id: xslt.c,v 1.14 2005-08-19 21:41:37 adam Exp $ +/* $Id: xslt.c,v 1.17 2005-08-24 08:30:37 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -96,6 +96,9 @@ static void set_param_int(const char **params, const char *name, params[2] = 0; } +#define ENABLE_INPUT_CALLBACK 0 + +#if ENABLE_INPUT_CALLBACK static int zebra_xmlInputMatchCallback (char const *filename) { yaz_log(YLOG_LOG, "match %s", filename); @@ -116,8 +119,9 @@ static int zebra_xmlInputCloseCallback (void * context) { return 0; } +#endif -static void *filter_init_xslt(Res res, RecType recType) +static void *filter_init(Res res, RecType recType) { struct filter_info *tinfo = (struct filter_info *) xmalloc(sizeof(*tinfo)); tinfo->reader = 0; @@ -128,7 +132,7 @@ static void *filter_init_xslt(Res res, RecType recType) tinfo->doc = 0; tinfo->schemas = 0; -#if 0 +#if ENABLE_INPUT_CALLBACK xmlRegisterDefaultInputCallbacks(); xmlRegisterInputCallbacks(zebra_xmlInputMatchCallback, zebra_xmlInputOpenCallback, @@ -440,8 +444,8 @@ static int extract_split(struct filter_info *tinfo, struct recExtractCtrl *p) xmlDocSetRootElement(doc, ptr2); - return extract_doc(tinfo, p, doc); - } + return extract_doc(tinfo, p, doc); + } ret = xmlTextReaderRead(tinfo->reader); } xmlFreeTextReader(tinfo->reader); @@ -543,7 +547,7 @@ static const char *snippet_doc(struct recRetrieveCtrl *p, int text_mode, static int filter_retrieve (void *clientData, struct recRetrieveCtrl *p) { const char *esn = zebra_xslt_ns; - const char *params[10]; + const char *params[20]; struct filter_info *tinfo = clientData; xmlDocPtr resDoc; xmlDocPtr doc; @@ -552,13 +556,18 @@ static int filter_retrieve (void *clientData, struct recRetrieveCtrl *p) if (p->comp) { - if (p->comp->which != Z_RecordComp_simple - || p->comp->u.simple->which != Z_ElementSetNames_generic) + if (p->comp->which == Z_RecordComp_simple + && p->comp->u.simple->which == Z_ElementSetNames_generic) + { + esn = p->comp->u.simple->u.generic; + } + else if (p->comp->which == Z_RecordComp_complex + && p->comp->u.complex->generic->elementSpec + && p->comp->u.complex->generic->elementSpec->which == + Z_ElementSpec_elementSetName) { - p->diagnostic = YAZ_BIB1_PRESENT_COMP_SPEC_PARAMETER_UNSUPP; - return 0; + esn = p->comp->u.complex->generic->elementSpec->u.elementSetName; } - esn = p->comp->u.simple->u.generic; } schema = lookup_schema(tinfo, esn); if (!schema) @@ -646,10 +655,10 @@ static int filter_retrieve (void *clientData, struct recRetrieveCtrl *p) return 0; } -static struct recType filter_type_xslt = { +static struct recType filter_type = { 0, "xslt", - filter_init_xslt, + filter_init, filter_config, filter_destroy, filter_extract, @@ -664,6 +673,6 @@ idzebra_filter #endif [] = { - &filter_type_xslt, + &filter_type, 0, };