| 2532 | |
| 2533 | #if HAVE_LIBXSLT |
| 2534 | static xmlNode *apply_transformation(xmlNode *xml, const char *transform) |
| 2535 | { |
| 2536 | char *xform = NULL; |
| 2537 | xmlNode *out = NULL; |
| 2538 | xmlDocPtr res = NULL; |
| 2539 | xmlDocPtr doc = NULL; |
| 2540 | xsltStylesheet *xslt = NULL; |
| 2541 | |
| 2542 | CRM_CHECK(xml != NULL, return FALSE); |
| 2543 | doc = getDocPtr(xml); |
| 2544 | xform = get_schema_path(transform); |
| 2545 | |
| 2546 | xmlLoadExtDtdDefaultValue = 1; |
| 2547 | xmlSubstituteEntitiesDefault(1); |
| 2548 | |
| 2549 | xslt = xsltParseStylesheetFile((const xmlChar *)xform); |
| 2550 | CRM_CHECK(xslt != NULL, goto cleanup); |
| 2551 | |
| 2552 | res = xsltApplyStylesheet(xslt, doc, NULL); |
| 2553 | CRM_CHECK(res != NULL, goto cleanup); |
| 2554 | |
| 2555 | out = xmlDocGetRootElement(res); |
| 2556 | |
| 2557 | cleanup: |
| 2558 | if(xslt) { |
| 2559 | xsltFreeStylesheet(xslt); |
| 2560 | } |
| 2561 | |
| 2562 | xsltCleanupGlobals(); |
| 2563 | xmlCleanupParser(); |
| 2564 | free(xform); |
| 2565 | |
| 2566 | return out; |
| 2567 | } |
| 2568 | #endif |
| 2569 | |
| 2570 | const char *get_schema_name(int version) |
no test coverage detected