Commit 42ccbc51 authored by Adam Martinson's avatar Adam Martinson Committed by Alexandre Julliard

msxml3: Add XSLPattern nodeType() method.

parent 8401caae
......@@ -405,6 +405,12 @@ void XSLPattern_end(xmlXPathParserContextPtr pctx, int nargs)
xmlXPathReturnBoolean(pctx, pos == last);
}
void XSLPattern_nodeType(xmlXPathParserContextPtr pctx, int nargs)
{
XSLPATTERN_CHECK_ARGS(0);
xmlXPathReturnNumber(pctx, pctx->context->node->type);
}
void XSLPattern_OP_IEq(xmlXPathParserContextPtr pctx, int nargs)
{
xmlChar *arg1, *arg2;
......@@ -528,6 +534,7 @@ HRESULT queryresult_create(xmlNodePtr node, LPCWSTR szQuery, IXMLDOMNodeList **o
xmlXPathRegisterFunc(ctxt, (xmlChar const*)"index", XSLPattern_index);
xmlXPathRegisterFunc(ctxt, (xmlChar const*)"end", XSLPattern_end);
xmlXPathRegisterFunc(ctxt, (xmlChar const*)"nodeType", XSLPattern_nodeType);
xmlXPathRegisterFunc(ctxt, (xmlChar const*)"OP_IEq", XSLPattern_OP_IEq);
xmlXPathRegisterFunc(ctxt, (xmlChar const*)"OP_INEq", XSLPattern_OP_INEq);
......
......@@ -6702,6 +6702,36 @@ static void test_XSLPattern(void)
expect_list_and_release(list, "P1.E3.E3.D1 C2.E3.E3.D1 T3.E3.E3.D1 E4.E3.E3.D1 E5.E3.E3.D1 E6.E3.E3.D1");
}
/* nodeType() */
/* XML_ELEMENT_NODE */
ole_check(IXMLDOMDocument2_selectNodes(doc, _bstr_("//x/node()[nodeType()=1]"), &list));
len = 0;
ole_check(IXMLDOMNodeList_get_length(list, &len));
ok(len != 0, "expected filled list\n");
if (len)
expect_list_and_release(list, "E4.E3.E3.D1 E5.E3.E3.D1 E6.E3.E3.D1");
/* XML_TEXT_NODE */
ole_check(IXMLDOMDocument2_selectNodes(doc, _bstr_("//x/node()[nodeType()=3]"), &list));
len = 0;
ole_check(IXMLDOMNodeList_get_length(list, &len));
ok(len != 0, "expected filled list\n");
if (len)
expect_list_and_release(list, "T3.E3.E3.D1");
/* XML_PI_NODE */
ole_check(IXMLDOMDocument2_selectNodes(doc, _bstr_("//x/node()[nodeType()=7]"), &list));
len = 0;
ole_check(IXMLDOMNodeList_get_length(list, &len));
ok(len != 0, "expected filled list\n");
if (len)
expect_list_and_release(list, "P1.E3.E3.D1");
/* XML_COMMENT_NODE */
ole_check(IXMLDOMDocument2_selectNodes(doc, _bstr_("//x/node()[nodeType()=8]"), &list));
len = 0;
ole_check(IXMLDOMNodeList_get_length(list, &len));
ok(len != 0, "expected filled list\n");
if (len)
expect_list_and_release(list, "C2.E3.E3.D1");
/* pi() */
todo_wine ole_check(IXMLDOMDocument2_selectNodes(doc, _bstr_("pi()"), &list));
if (list)
......
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