Commit 77b7323b authored by Adam Martinson's avatar Adam Martinson Committed by Alexandre Julliard

msxml3: Fix XSLPattern namespace handling.

parent 6241b9d6
......@@ -53,7 +53,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msxml);
int registerNamespaces(xmlXPathContextPtr ctxt);
BOOL is_xpathmode(const xmlDocPtr doc);
xmlChar* XSLPattern_to_XPath(xmlChar const* xslpat_str);
xmlChar* XSLPattern_to_XPath(xmlXPathContextPtr ctxt, xmlChar const* xslpat_str);
typedef struct _queryresult
{
......@@ -393,7 +393,7 @@ void XSLPattern_invalid(xmlXPathParserContextPtr pctx, int nargs)
#define XSLPATTERN_CHECK_ARGS(n) \
if (nargs != n) { \
FIXME("XSLPattern syntax error: Expected 0 arguments, got %i\n", nargs); \
FIXME("XSLPattern syntax error: Expected %i arguments, got %i\n", n, nargs); \
XSLPattern_invalid(pctx, nargs); \
return; \
}
......@@ -531,7 +531,7 @@ HRESULT queryresult_create(xmlNodePtr node, LPCWSTR szQuery, IXMLDOMNodeList **o
xmlChar* tmp;
int len;
WARN("Attempting XSLPattern emulation (experimental).\n");
tmp = XSLPattern_to_XPath(str);
tmp = XSLPattern_to_XPath(ctxt, str);
len = (xmlStrlen(tmp)+1)*sizeof(xmlChar);
str = heap_realloc(str, len);
memcpy(str, tmp, len);
......
......@@ -6487,36 +6487,27 @@ static void test_XSLPattern(void)
list = NULL;
/* prefixes don't need to be registered, you may use them as they are in the doc */
todo_wine ole_check(IXMLDOMDocument2_selectNodes(doc, _bstr_("//bar:x"), &list));
if (list)
{
ole_check(IXMLDOMDocument2_selectNodes(doc, _bstr_("//bar:x"), &list));
len = 0;
ole_check(IXMLDOMNodeList_get_length(list, &len));
todo_wine ok(len != 0, "expected filled list\n");
ok(len != 0, "expected filled list\n");
if (len)
todo_wine expect_list_and_release(list, "E5.E1.E4.E1.E2.D1 E6.E2.E4.E1.E2.D1");
}
expect_list_and_release(list, "E5.E1.E4.E1.E2.D1 E6.E2.E4.E1.E2.D1");
/* prefixes must be explicitly specified in the name */
todo_wine ole_check(IXMLDOMDocument2_selectNodes(doc, _bstr_("//foo:elem"), &list));
if (list)
{
ole_check(IXMLDOMDocument2_selectNodes(doc, _bstr_("//foo:elem"), &list));
len = 0;
ole_check(IXMLDOMNodeList_get_length(list, &len));
todo_wine ok(len == 0, "expected empty list\n");
ok(len == 0, "expected empty list\n");
if (len)
IXMLDOMNodeList_Release(list);
}
todo_wine ole_check(IXMLDOMDocument2_selectNodes(doc, _bstr_("//foo:c"), &list));
if (list)
{
ole_check(IXMLDOMDocument2_selectNodes(doc, _bstr_("//foo:c"), &list));
len = 0;
ole_check(IXMLDOMNodeList_get_length(list, &len));
todo_wine ok(len != 0, "expected filled list\n");
ok(len != 0, "expected filled list\n");
if (len)
todo_wine expect_list_and_release(list, "E3.E4.E2.D1");
}
expect_list_and_release(list, "E3.E4.E2.D1");
/* explicitly register prefix foo */
ole_check(IXMLDOMDocument2_setProperty(doc, _bstr_("SelectionNamespaces"), _variantbstr_("xmlns:foo='urn:uuid:86B2F87F-ACB6-45cd-8B77-9BDB92A01A29'")));
......
......@@ -33,9 +33,11 @@
#include <libxml/tree.h>
#include <libxml/xmlstring.h>
#include <libxml/xpath.h>
typedef struct _parser_param {
void* yyscanner;
xmlXPathContextPtr ctx;
xmlChar const* in;
int pos;
int len;
......
......@@ -151,11 +151,12 @@ ANY (.)
%%
xmlChar* XSLPattern_to_XPath(xmlChar const* xslpat_str)
xmlChar* XSLPattern_to_XPath(xmlXPathContextPtr ctxt, xmlChar const* xslpat_str)
{
parser_param p;
TRACE("(%s)\n", wine_dbgstr_a((char const*)xslpat_str));
memset(&p, 0, sizeof(parser_param));
p.ctx = ctxt;
p.in = xslpat_str;
p.len = xmlStrlen(xslpat_str);
......
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