MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / apply_transformation

Function apply_transformation

lib/common/xml.c:2534–2567  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2532
2533#if HAVE_LIBXSLT
2534static 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
2570const char *get_schema_name(int version)

Callers 1

update_validationFunction · 0.85

Calls 2

getDocPtrFunction · 0.85
get_schema_pathFunction · 0.85

Tested by

no test coverage detected