+void Yaz_Proxy::convert_xsl(Z_NamePlusRecordList *p)
+{
+ if (!m_stylesheet_schema)
+ return;
+ xsltStylesheetPtr xsp;
+
+ xsp = xsltParseStylesheetFile((const xmlChar *) m_stylesheet_schema);
+
+ int i;
+ for (i = 0; i < p->num_records; i++)
+ {
+ Z_NamePlusRecord *npr = p->records[i];
+ if (npr->which == Z_NamePlusRecord_databaseRecord)
+ {
+ Z_External *r = npr->u.databaseRecord;
+ if (r->which == Z_External_octet)
+ {
+ xmlDocPtr res, doc = xmlParseMemory(
+ (char*) r->u.octet_aligned->buf,
+ r->u.octet_aligned->len);
+
+ res = xsltApplyStylesheet(xsp, doc, 0);
+
+ xmlChar *out_buf;
+ int out_len;
+ xmlDocDumpFormatMemory (res, &out_buf, &out_len, 1);
+
+ p->records[i]->u.databaseRecord =
+ z_ext_record(odr_encode(), VAL_TEXT_XML,
+ (char*) out_buf, out_len);
+ xmlFree(out_buf);
+ xmlFreeDoc(doc);
+ xmlFreeDoc(res);
+ }
+ }
+ }
+ xsltFreeStylesheet(xsp);
+}
+