-/* $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
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);
{
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;
tinfo->doc = 0;
tinfo->schemas = 0;
-#if 0
+#if ENABLE_INPUT_CALLBACK
xmlRegisterDefaultInputCallbacks();
xmlRegisterInputCallbacks(zebra_xmlInputMatchCallback,
zebra_xmlInputOpenCallback,
xmlDocSetRootElement(doc, ptr2);
- return extract_doc(tinfo, p, doc);
- }
+ return extract_doc(tinfo, p, doc);
+ }
ret = xmlTextReaderRead(tinfo->reader);
}
xmlFreeTextReader(tinfo->reader);
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;
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)
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,
#endif
[] = {
- &filter_type_xslt,
+ &filter_type,
0,
};