[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] pattern matching possible?


Subject: RE: [xsl] pattern matching possible?
From: "Hansen, John" <John.Hansen@xxxxxxxxxx>
Date: Thu, 13 May 2004 06:23:01 -0700

While you might think you are using MSXML4 you can't actually be using
it if you get an error when using translate because DOMDocument40 sets
the SelectionLanguage second level property to XPath *by default* and
you can't actually select another language (it doesn't support the old
selection language).

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/
htm/xml2nd_pro_v4_9rc5.asp

<quote>
In MSXML 3.0 you can set this property to "XPath" to switch the query
language from XSLPattern to XPath. After the property is set, there is
no way to switch back without creating an instance of a new DOM object. 

MSXML 4.0 and later supports XPath as the only query language. This
property is always set to "XPath" in MSXML 4.0 and later. You can ignore
this property completely.
</quote>

On the page you reference below it says:

'To use MSXML 4.0, you need to use 4.0 dependent progid explicitly.

Which means you need to 

set oXML = Server.CreateObject("Msxml2.DOMDocument.4.0"); 

Rather than

set oXML = Server.CreateObject("Msxml2.DOMDocument"); 

Again, if you really are using MSXML4 then there is no need to set the
selection language to XPath.

-----Original Message-----
From: Hardy Merrill [mailto:HMerrill@xxxxxxxxxxxxxxxx] 
Sent: Thursday, May 13, 2004 8:01 AM
To: Hansen, John; xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] pattern matching possible?


A co-worker of mine found the answer this morning on MS support site:

   http://support.microsoft.com/default.aspx?scid=kb;en-us;315719

Note that we *are* using MSXML 4.

Here's a snipped from that page:

SUMMARY
MSXML includes two functions that you can use to filter data in a
case-insensitive search. With MSXML 3.0, you can use the translate
function. With MSXML 4.0, you can use either the translate function or
the new ms:string-compare XPath function. 

oXML.setProperty "SelectionLanguage", "XPath"
set node = oXML.selectSingleNode("Domains/DomainName[translate(.,
'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') =
'mydomain1.com']")
---------------------------------------------------------
So, going with the "translate" approach, all we had to do was add this
line:

     oXML.setProperty "SelectionLanguage", "XPath"

and then our translate worked fine.

Thanks for the input.

Hardy Merrill


Current Thread
Keywords