+ else if (enable_pz2_transform)
+ {
+ char rec_type_str[100];
+
+ strcpy(rec_type_str, b->sptr->use_turbomarc ?
+ "txml" : "xml");
+
+ // prevent buffer overflow ...
+ if (b->sptr->record_encoding.length() > 0 &&
+ b->sptr->record_encoding.length() <
+ (sizeof(rec_type_str)-20))
+ {
+ strcat(rec_type_str, "; charset=");
+ strcat(rec_type_str, b->sptr->record_encoding.c_str());
+ }
+
+ int rec_len;
+ const char *rec_buf = ZOOM_record_get(recs[i], rec_type_str,
+ &rec_len);
+ if (rec_buf && b->xsp)
+ {
+ xmlDoc *rec_doc = xmlParseMemory(rec_buf, rec_len);
+ if (rec_doc)
+ {
+ xmlDoc *rec_res;
+ rec_res = xsltApplyStylesheet(b->xsp, rec_doc, 0);
+
+ if (rec_res)
+ xsltSaveResultToString((xmlChar **) &rec_buf, &rec_len,
+ rec_res, b->xsp);
+ }
+ }
+
+ if (rec_buf)
+ {
+ npr = (Z_NamePlusRecord *) odr_malloc(odr, sizeof(*npr));
+ npr->databaseName = odr_database;
+ npr->which = Z_NamePlusRecord_databaseRecord;
+ npr->u.databaseRecord =
+ z_ext_record_xml(odr, rec_buf, rec_len);
+ }
+ else
+ {
+ npr = zget_surrogateDiagRec(
+ odr, odr_database,
+ YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS,
+ rec_type_str);
+ }
+ }