Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Xpath functions

Can any one tell me how to access the xpath functions such as "translate(),
starts-with() " either in vbscript or javascript ?

I tried this --
<script language="javascript>
function findEmp(xmlSource){
var xmlResult= xmlSource.documentElement.selectSingleNode("/employees/employee[starts-with("
+ sSearchNode + "," + sSearchText + ")]");
}
but getting error as unknown function/method ?
[432 byte] By [Vandana] at [2007-11-9 15:28:52]
# 1 Re: Xpath functions
>>
Can any one tell me how to access the xpath functions such as "translate(),
starts-with() " either in vbscript or javascript ?
<<

The problem here is that by default MSXML use XSL Pattern as it's selection
language not XPath. Adding the following line of code may help:

xmlSource.setProperty "SelectionLanguage", "XPath"

However it does require MSXML 2.5 or higher.

Anthony.
Anthony Jones at 2007-11-11 23:29:44 >