X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Frecord_conv.c;h=a74b4c55a6f0753d00f8eb8d765f2c7c41be7885;hb=20c28e99eaa71d4b73e8c03c8cfaf23653948da7;hp=e6e1cdda3924f11b78d074d745029bc161baef28;hpb=417ea0996dadd8b89ab767bfbfbd0aaaf64f07ad;p=yaz-moved-to-github.git diff --git a/src/record_conv.c b/src/record_conv.c index e6e1cdd..a74b4c5 100644 --- a/src/record_conv.c +++ b/src/record_conv.c @@ -378,17 +378,18 @@ static int convert_select(void *vinfo, WRBUF record, WRBUF wr_error) if (xpathObj) { xmlNodeSetPtr nodes = xpathObj->nodesetval; - wrbuf_rewind(record); if (nodes) { int i; + if (nodes->nodeNr > 0) + wrbuf_rewind(record); for (i = 0; i < nodes->nodeNr; i++) { xmlNode *ptr = nodes->nodeTab[i]; if (ptr->type == XML_ELEMENT_NODE) ptr = ptr->children; - if (ptr->type == XML_TEXT_NODE) - for (; ptr; ptr = ptr->next) + for (; ptr; ptr = ptr->next) + if (ptr->type == XML_TEXT_NODE) wrbuf_puts(record, (const char *) ptr->content); } }