X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=recctrl%2Fxslt.c;h=6544b37baeab3e015c1239715e41fe72efeff3ad;hb=1722bbb1db5ba2b1cf096388cf3206863ae0a203;hp=cced009a04cfc5eb222f7bd7bf3ee7608b8d8e8c;hpb=ecb3935e78cd9bcfdebafdee0834cfb1060d7b5e;p=idzebra-moved-to-github.git diff --git a/recctrl/xslt.c b/recctrl/xslt.c index cced009..6544b37 100644 --- a/recctrl/xslt.c +++ b/recctrl/xslt.c @@ -1,4 +1,4 @@ -/* $Id: xslt.c,v 1.21 2006-05-10 08:13:31 adam Exp $ +/* $Id: xslt.c,v 1.24 2006-05-24 12:56:56 marc Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -273,16 +273,24 @@ static struct filter_xslt_schema *lookup_schema(struct filter_xslt_info *tinfo, struct filter_xslt_schema *schema; for (schema = tinfo->schemas; schema; schema = schema->next) { - if (est) - { + /* 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; - } - if (schema->default_schema) + } + /* or return default schema if defined */ + else if (schema->default_schema) return schema; } + + /* return first schema if no default schema defined */ + if (tinfo->schemas) + return tinfo->schemas; + return 0; } @@ -593,8 +601,8 @@ 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[20]; + const char *esn = 0; + const char *params[32]; struct filter_xslt_info *tinfo = clientData; xmlDocPtr resDoc; xmlDocPtr doc; @@ -633,7 +641,17 @@ static int filter_retrieve (void *clientData, struct recRetrieveCtrl *p) set_param_str(params, "filename", p->fname, p->odr); if (p->staticrank >= 0) set_param_int(params, "rank", p->staticrank, p->odr); - set_param_str(params, "schema", esn, p->odr); + + if (esn) + set_param_str(params, "schema", esn, p->odr); + else + if (schema->name) + set_param_str(params, "schema", schema->name, p->odr); + else if (schema->identifier) + set_param_str(params, "schema", schema->identifier, p->odr); + else + set_param_str(params, "schema", "", p->odr); + if (p->score >= 0) set_param_int(params, "score", p->score, p->odr); set_param_int(params, "size", p->recordSize, p->odr);