msxml3: Respect stylesheet output mode when dumping resulting document.
This commit is contained in:
parent
28cc0b8bc1
commit
02af74400f
@ -173,6 +173,7 @@ DECL_FUNCPTR(xsltFreeTransformContext);
|
|||||||
DECL_FUNCPTR(xsltNewTransformContext);
|
DECL_FUNCPTR(xsltNewTransformContext);
|
||||||
DECL_FUNCPTR(xsltParseStylesheetDoc);
|
DECL_FUNCPTR(xsltParseStylesheetDoc);
|
||||||
DECL_FUNCPTR(xsltQuoteUserParams);
|
DECL_FUNCPTR(xsltQuoteUserParams);
|
||||||
|
DECL_FUNCPTR(xsltSaveResultTo);
|
||||||
# undef DECL_FUNCPTR
|
# undef DECL_FUNCPTR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -197,6 +198,7 @@ static void init_libxslt(void)
|
|||||||
LOAD_FUNCPTR(xsltNewTransformContext, 1);
|
LOAD_FUNCPTR(xsltNewTransformContext, 1);
|
||||||
LOAD_FUNCPTR(xsltParseStylesheetDoc, 1);
|
LOAD_FUNCPTR(xsltParseStylesheetDoc, 1);
|
||||||
LOAD_FUNCPTR(xsltQuoteUserParams, 1);
|
LOAD_FUNCPTR(xsltQuoteUserParams, 1);
|
||||||
|
LOAD_FUNCPTR(xsltSaveResultTo, 1);
|
||||||
#undef LOAD_FUNCPTR
|
#undef LOAD_FUNCPTR
|
||||||
|
|
||||||
if (pxsltInit)
|
if (pxsltInit)
|
||||||
|
@ -67,6 +67,7 @@ MAKE_FUNCPTR(xsltFreeTransformContext);
|
|||||||
MAKE_FUNCPTR(xsltNewTransformContext);
|
MAKE_FUNCPTR(xsltNewTransformContext);
|
||||||
MAKE_FUNCPTR(xsltParseStylesheetDoc);
|
MAKE_FUNCPTR(xsltParseStylesheetDoc);
|
||||||
MAKE_FUNCPTR(xsltQuoteUserParams);
|
MAKE_FUNCPTR(xsltQuoteUserParams);
|
||||||
|
MAKE_FUNCPTR(xsltSaveResultTo);
|
||||||
# undef MAKE_FUNCPTR
|
# undef MAKE_FUNCPTR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1058,30 +1059,16 @@ HRESULT node_transform_node_params(const xmlnode *This, IXMLDOMNode *stylesheet,
|
|||||||
{
|
{
|
||||||
const xmlChar *content;
|
const xmlChar *content;
|
||||||
|
|
||||||
if(result->type == XML_HTML_DOCUMENT_NODE)
|
xmlOutputBufferPtr output = xmlAllocOutputBuffer(NULL);
|
||||||
|
if (output)
|
||||||
{
|
{
|
||||||
xmlOutputBufferPtr output = xmlAllocOutputBuffer(NULL);
|
if(result->type == XML_HTML_DOCUMENT_NODE)
|
||||||
if (output)
|
|
||||||
{
|
|
||||||
htmldoc_dumpcontent(output, result->doc);
|
htmldoc_dumpcontent(output, result->doc);
|
||||||
content = get_output_buffer_content(output);
|
else
|
||||||
*p = bstr_from_xmlChar(content);
|
pxsltSaveResultTo(output, result->doc, xsltSS);
|
||||||
xmlOutputBufferClose(output);
|
content = get_output_buffer_content(output);
|
||||||
}
|
*p = bstr_from_xmlChar(content);
|
||||||
}
|
xmlOutputBufferClose(output);
|
||||||
else
|
|
||||||
{
|
|
||||||
xmlBufferPtr buf = xmlBufferCreate();
|
|
||||||
if (buf)
|
|
||||||
{
|
|
||||||
int size = xmlNodeDump(buf, NULL, (xmlNodePtr)result, 0, 0);
|
|
||||||
if(size > 0)
|
|
||||||
{
|
|
||||||
content = xmlBufferContent(buf);
|
|
||||||
*p = bstr_from_xmlChar(content);
|
|
||||||
}
|
|
||||||
xmlBufferFree(buf);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
xmlFreeDoc(result);
|
xmlFreeDoc(result);
|
||||||
}
|
}
|
||||||
|
@ -11659,6 +11659,32 @@ static const char xsltext_xsl[] =
|
|||||||
"</xsl:template>"
|
"</xsl:template>"
|
||||||
"</xsl:stylesheet>";
|
"</xsl:stylesheet>";
|
||||||
|
|
||||||
|
static const char omitxmldecl_xsl[] =
|
||||||
|
"<?xml version=\"1.0\"?>"
|
||||||
|
"<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" >"
|
||||||
|
"<xsl:output method=\"xml\" omit-xml-declaration=\"yes\"/>"
|
||||||
|
"<xsl:template match=\"/\">"
|
||||||
|
" <xsl:for-each select=\"/a/item\">"
|
||||||
|
" <xsl:element name=\"node\">"
|
||||||
|
" <xsl:value-of select=\"@name\"/>"
|
||||||
|
" </xsl:element>"
|
||||||
|
" </xsl:for-each>"
|
||||||
|
"</xsl:template>"
|
||||||
|
"</xsl:stylesheet>";
|
||||||
|
|
||||||
|
static const char omitxmldecl_doc[] =
|
||||||
|
"<?xml version=\"1.0\"?>"
|
||||||
|
"<a>"
|
||||||
|
" <item name=\"item1\"/>"
|
||||||
|
" <item name=\"item2\"/>"
|
||||||
|
"</a>";
|
||||||
|
|
||||||
|
static const char omitxmldecl_result[] =
|
||||||
|
"<node>item1</node><node>item2</node>";
|
||||||
|
|
||||||
|
static const char omitxmldecl_result2[] =
|
||||||
|
"<node>item1</node><node>item2</node>\n";
|
||||||
|
|
||||||
static void test_xsltext(void)
|
static void test_xsltext(void)
|
||||||
{
|
{
|
||||||
IXMLDOMDocument *doc, *doc2;
|
IXMLDOMDocument *doc, *doc2;
|
||||||
@ -11680,6 +11706,19 @@ static void test_xsltext(void)
|
|||||||
ok(!lstrcmpW(ret, _bstr_("testdata")), "transform result %s\n", wine_dbgstr_w(ret));
|
ok(!lstrcmpW(ret, _bstr_("testdata")), "transform result %s\n", wine_dbgstr_w(ret));
|
||||||
SysFreeString(ret);
|
SysFreeString(ret);
|
||||||
|
|
||||||
|
/* omit-xml-declaration */
|
||||||
|
hr = IXMLDOMDocument_loadXML(doc, _bstr_(omitxmldecl_xsl), &b);
|
||||||
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
hr = IXMLDOMDocument_loadXML(doc2, _bstr_(omitxmldecl_doc), &b);
|
||||||
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
|
||||||
|
hr = IXMLDOMDocument_transformNode(doc2, (IXMLDOMNode*)doc, &ret);
|
||||||
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
/* Old enough libxslt places extra '\n' at the end of the output. */
|
||||||
|
ok(!lstrcmpW(ret, _bstr_(omitxmldecl_result)) ||
|
||||||
|
!lstrcmpW(ret, _bstr_(omitxmldecl_result2)), "transform result %s\n", wine_dbgstr_w(ret));
|
||||||
|
SysFreeString(ret);
|
||||||
|
|
||||||
IXMLDOMDocument_Release(doc2);
|
IXMLDOMDocument_Release(doc2);
|
||||||
IXMLDOMDocument_Release(doc);
|
IXMLDOMDocument_Release(doc);
|
||||||
free_bstrs();
|
free_bstrs();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user