Commit 52c6c6a1 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

msxml3: Fix transformation result output for stream and BSTR cases.

parent 7367c68c
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
# ifdef HAVE_LIBXSLT_TRANSFORM_H # ifdef HAVE_LIBXSLT_TRANSFORM_H
# include <libxslt/transform.h> # include <libxslt/transform.h>
# endif # endif
# include <libxslt/imports.h>
# include <libxslt/xsltutils.h> # include <libxslt/xsltutils.h>
# include <libxslt/variables.h> # include <libxslt/variables.h>
# include <libxslt/xsltInternals.h> # include <libxslt/xsltInternals.h>
...@@ -171,6 +172,7 @@ DECL_FUNCPTR(xsltCleanupGlobals); ...@@ -171,6 +172,7 @@ DECL_FUNCPTR(xsltCleanupGlobals);
DECL_FUNCPTR(xsltFreeStylesheet); DECL_FUNCPTR(xsltFreeStylesheet);
DECL_FUNCPTR(xsltFreeTransformContext); DECL_FUNCPTR(xsltFreeTransformContext);
DECL_FUNCPTR(xsltNewTransformContext); DECL_FUNCPTR(xsltNewTransformContext);
DECL_FUNCPTR(xsltNextImport);
DECL_FUNCPTR(xsltParseStylesheetDoc); DECL_FUNCPTR(xsltParseStylesheetDoc);
DECL_FUNCPTR(xsltQuoteUserParams); DECL_FUNCPTR(xsltQuoteUserParams);
DECL_FUNCPTR(xsltSaveResultTo); DECL_FUNCPTR(xsltSaveResultTo);
...@@ -196,6 +198,7 @@ static void init_libxslt(void) ...@@ -196,6 +198,7 @@ static void init_libxslt(void)
LOAD_FUNCPTR(xsltFreeStylesheet, 1); LOAD_FUNCPTR(xsltFreeStylesheet, 1);
LOAD_FUNCPTR(xsltFreeTransformContext, 1); LOAD_FUNCPTR(xsltFreeTransformContext, 1);
LOAD_FUNCPTR(xsltNewTransformContext, 1); LOAD_FUNCPTR(xsltNewTransformContext, 1);
LOAD_FUNCPTR(xsltNextImport, 1);
LOAD_FUNCPTR(xsltParseStylesheetDoc, 1); LOAD_FUNCPTR(xsltParseStylesheetDoc, 1);
LOAD_FUNCPTR(xsltQuoteUserParams, 1); LOAD_FUNCPTR(xsltQuoteUserParams, 1);
LOAD_FUNCPTR(xsltSaveResultTo, 1); LOAD_FUNCPTR(xsltSaveResultTo, 1);
......
...@@ -367,7 +367,7 @@ extern HRESULT node_get_text(const xmlnode*,BSTR*) DECLSPEC_HIDDEN; ...@@ -367,7 +367,7 @@ extern HRESULT node_get_text(const xmlnode*,BSTR*) DECLSPEC_HIDDEN;
extern HRESULT node_select_nodes(const xmlnode*,BSTR,IXMLDOMNodeList**) DECLSPEC_HIDDEN; extern HRESULT node_select_nodes(const xmlnode*,BSTR,IXMLDOMNodeList**) DECLSPEC_HIDDEN;
extern HRESULT node_select_singlenode(const xmlnode*,BSTR,IXMLDOMNode**) DECLSPEC_HIDDEN; extern HRESULT node_select_singlenode(const xmlnode*,BSTR,IXMLDOMNode**) DECLSPEC_HIDDEN;
extern HRESULT node_transform_node(const xmlnode*,IXMLDOMNode*,BSTR*) DECLSPEC_HIDDEN; extern HRESULT node_transform_node(const xmlnode*,IXMLDOMNode*,BSTR*) DECLSPEC_HIDDEN;
extern HRESULT node_transform_node_params(const xmlnode*,IXMLDOMNode*,BSTR*,const struct xslprocessor_params*) DECLSPEC_HIDDEN; extern HRESULT node_transform_node_params(const xmlnode*,IXMLDOMNode*,BSTR*,IStream*,const struct xslprocessor_params*) DECLSPEC_HIDDEN;
extern HRESULT node_create_supporterrorinfo(const tid_t*,void**) DECLSPEC_HIDDEN; extern HRESULT node_create_supporterrorinfo(const tid_t*,void**) DECLSPEC_HIDDEN;
extern HRESULT get_domdoc_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document) DECLSPEC_HIDDEN; extern HRESULT get_domdoc_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document) DECLSPEC_HIDDEN;
......
...@@ -477,7 +477,7 @@ static HRESULT WINAPI xslprocessor_put_output( ...@@ -477,7 +477,7 @@ static HRESULT WINAPI xslprocessor_put_output(
WARN("failed to get IStream from output, 0x%08x\n", hr); WARN("failed to get IStream from output, 0x%08x\n", hr);
break; break;
default: default:
FIXME("output type %d not handed\n", V_VT(&output)); FIXME("output type %d not handled\n", V_VT(&output));
hr = E_FAIL; hr = E_FAIL;
} }
...@@ -530,22 +530,8 @@ static HRESULT WINAPI xslprocessor_transform( ...@@ -530,22 +530,8 @@ static HRESULT WINAPI xslprocessor_transform(
if (!ret) return E_INVALIDARG; if (!ret) return E_INVALIDARG;
SysFreeString(This->outstr); SysFreeString(This->outstr);
hr = node_transform_node_params(get_node_obj(This->input), This->stylesheet->node, &This->outstr, This->output, &This->params);
hr = node_transform_node_params(get_node_obj(This->input), This->stylesheet->node, &This->outstr, &This->params); *ret = hr == S_OK ? VARIANT_TRUE : VARIANT_FALSE;
if (hr == S_OK)
{
if (This->output)
{
ULONG len = 0;
/* output to stream */
hr = IStream_Write(This->output, This->outstr, SysStringByteLen(This->outstr), &len);
*ret = len == SysStringByteLen(This->outstr) ? VARIANT_TRUE : VARIANT_FALSE;
}
}
else
*ret = VARIANT_FALSE;
return hr; return hr;
#else #else
FIXME("libxml2 is required but wasn't present at compile time\n"); FIXME("libxml2 is required but wasn't present at compile time\n");
......
...@@ -6121,7 +6121,7 @@ static void test_testTransforms(void) ...@@ -6121,7 +6121,7 @@ static void test_testTransforms(void)
ok(hr == S_OK, "ret %08x\n", hr ); ok(hr == S_OK, "ret %08x\n", hr );
if(hr == S_OK) if(hr == S_OK)
{ {
ok( compareIgnoreReturns( bOut, _bstr_(szTransformOutput)), "Stylesheet output not correct\n"); ok( compareIgnoreReturns( bOut, _bstr_(szTransformOutput)), "got output %s\n", wine_dbgstr_w(bOut));
SysFreeString(bOut); SysFreeString(bOut);
} }
...@@ -8471,7 +8471,7 @@ todo_wine { ...@@ -8471,7 +8471,7 @@ todo_wine {
hr = IXSLProcessor_get_output(processor, &v); hr = IXSLProcessor_get_output(processor, &v);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
ok(V_VT(&v) == VT_BSTR, "got type %d\n", V_VT(&v)); ok(V_VT(&v) == VT_BSTR, "got type %d\n", V_VT(&v));
ok(lstrcmpW(V_BSTR(&v), _bstr_("")) == 0, "got %s\n", wine_dbgstr_w(V_BSTR(&v))); ok(*V_BSTR(&v) == 0, "got %s\n", wine_dbgstr_w(V_BSTR(&v)));
IXMLDOMDocument_Release(doc2); IXMLDOMDocument_Release(doc2);
VariantClear(&v); VariantClear(&v);
...@@ -11695,12 +11695,6 @@ static const char omitxmldecl_doc[] = ...@@ -11695,12 +11695,6 @@ static const char omitxmldecl_doc[] =
" <item name=\"item2\"/>" " <item name=\"item2\"/>"
"</a>"; "</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;
...@@ -11730,9 +11724,7 @@ static void test_xsltext(void) ...@@ -11730,9 +11724,7 @@ static void test_xsltext(void)
hr = IXMLDOMDocument_transformNode(doc2, (IXMLDOMNode*)doc, &ret); hr = IXMLDOMDocument_transformNode(doc2, (IXMLDOMNode*)doc, &ret);
ok(hr == S_OK, "got 0x%08x\n", hr); 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_("<node>item1</node><node>item2</node>")), "transform result %s\n", wine_dbgstr_w(ret));
ok(!lstrcmpW(ret, _bstr_(omitxmldecl_result)) ||
!lstrcmpW(ret, _bstr_(omitxmldecl_result2)), "transform result %s\n", wine_dbgstr_w(ret));
SysFreeString(ret); SysFreeString(ret);
IXMLDOMDocument_Release(doc2); IXMLDOMDocument_Release(doc2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment