diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c index ccecaa8cbb2..c5a180b47be 100644 --- a/dlls/msxml3/node.c +++ b/dlls/msxml3/node.c @@ -1320,6 +1320,7 @@ HRESULT node_transform_node_params(const xmlnode *This, IXMLDOMNode *stylesheet, { #ifdef SONAME_LIBXSLT xsltStylesheetPtr xsltSS; + xmlDocPtr sheet_doc; HRESULT hr = S_OK; xmlnode *sheet; @@ -1331,8 +1332,9 @@ HRESULT node_transform_node_params(const xmlnode *This, IXMLDOMNode *stylesheet, sheet = get_node_obj(stylesheet); if(!sheet) return E_FAIL; - xsltSS = pxsltParseStylesheetDoc(sheet->node->doc); - if(xsltSS) + sheet_doc = xmlCopyDoc(sheet->node->doc, 1); + xsltSS = pxsltParseStylesheetDoc(sheet_doc); + if (xsltSS) { const char **xslparams = NULL; xmlDocPtr result; @@ -1377,11 +1379,11 @@ HRESULT node_transform_node_params(const xmlnode *This, IXMLDOMNode *stylesheet, hr = node_transform_write_to_bstr(xsltSS, result, p); xmlFreeDoc(result); } - /* libxslt "helpfully" frees the XML document the stylesheet was - generated from, too */ - xsltSS->doc = NULL; + pxsltFreeStylesheet(xsltSS); } + else + xmlFreeDoc(sheet_doc); if(!*p) *p = SysAllocStringLen(NULL, 0);