RE: XSL Pattern Queries (values & filters) with DOM

>
> I'm attempting to use XSL Pattern Queries with the selectNodes &
> selectSingleNode methods of the DOM (VB6).  While I've managed to do this
> successfully with basic pattern queries, I haven't had any luck trying to
> incorporate values, filters or any complex patterns.  Does the DOM provide
> this functionality?  Perhaps the these patterns (if supported) require
> additional code before they can be used with the DOM?
> If anybody can provide insight into this problem please let me know.
>

You can use XPath 1.0 with MSXML's selectNodes/selectSingleNode functions to
get the filtering capabilities that you desire. The only catch is that you
have to call setProperty specifying the selection language as XPath:

set doc = new msxml2.domdocument
doc.setProperty "SelectionLanguage", "XPath"
set nl = doc.selectNodes("/descendant::book[child::author = 'Aaron']")

If you don't set the selectionLanguage, MSXML defaults to XSL patterns,
which is significantly different than XPath. As pointed out, these APIs are
MSXML specific and not part of the DOM. Although, I strongly believe that it
would be *extremely* beneficial to have a standard query API for executing
XPath queries built into the DOM spec. It seems like a no-brainer.

-aaron

Received on Thursday, 13 April 2000 21:59:22 UTC