473,836 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SelectNodes Xpath Contains - Getting XSLT Unknown Function error

I am trying to get certain nodes within an xml doc that contain certain
text (similar to a SQL LIKE). In doing so I am using the XPATH Contains
function and have not been successful. When I run I get the following
error:
System.Xml.XPat h.XPathExceptio n: XsltContext is needed for this query
because of an unknown function.

I can successfully get simple xpath queries to work, just none using
the Contains function. Any help would be appreciated.

---------------------------------------------------------
Dim dom As New XmlDocument
Dim nodeList As XmlNodeList
Dim nsManager As New XmlNamespaceMan ager(dom.NameTa ble)

nsManager.AddNa mespace("xsi",
"http://www.w3.org/2001/XMLSchema-instance")

dom.Load(txtFil e.Text)

Dim query As String = "//TypeName[Contains(., '_LU_')]"
nodeList = dom.SelectNodes (query, nsManager)

Tim

Nov 12 '05 #1
2 4853


ts*******@gmail .com wrote:

Dim query As String = "//TypeName[Contains(., '_LU_')]"


You are VB impaired where case does not matter but for XPath and XSLT
function names it does matter so try the function 'contains':
"//TypeName[contains(., '_LU_')]"

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Nov 12 '05 #2
Martin, thanks for easily spotting that!!

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2800
by: Robert Mark Bram | last post by:
Hi All! In the code below, I am reading in an xhtml document and attempting to use selectNodes to find a <p id="rmb"> node.. But the result is: 2 - */* 0 - */p Can anyone suggest what I am doing wrong?
2
7754
by: Echo 8 | last post by:
Is there a simple way of compare dates? I am trying to create a list of perishable stock in an inventory that is near or past its expiration date. I've tried telling it to compare a node's value with a DateTime string, but that doesn't work. I've assumed that it is easier to manipulate today's date instead of the date in my ExpireDate element. Thankyou in advanced for taking the time to read this and possibly helping me
2
1499
by: Jack Black | last post by:
Hi, all! Using VS.Net 2003 (vb.net)... I've build a sample app (Windows application) to manipulate xml data from file, and all works fine. However, when I move code that works fine from the Windows app into a SmartDevice app template, I'm getting an error telling me that 'SelectNodes is not a member of System.Xml.XmlDocument'. Is there a difference between the classes when used in a Windows app versus a SmartDevice app?? Seems to me...
2
2190
by: Linda Boumarafi | last post by:
Hi, This is a newbie question to XMLNS. I just finished the article on "XML Namespaces and How They Affect XPath and XSLT" by Dare Obasanjo and I'm pretty sure I understand the problem. I just don't know how to achieve the desired XPath result. I'm dealing with an XML document that has two XMLNS' in the root node (Report) and I'm ending up with 0 results using SelectNodes. If I take out both namespaces, the SelectNodes(XPathQuery) works...
3
2225
by: Woon Kiat | last post by:
I have this Xml file, bookstore.xml <Bookstore xmlns="http://www.book.com"> <Shelve index="1"> <Book name="Da Vinci Code" /> </Shelve> <Shelve index="2"> <Book name="The Holy Grail" /> </Shelve> <Shelve index="3">
3
2422
by: John Smith | last post by:
I'm trying to make some Javascript X-browser. foo is a HTML DOM. I have foo.documentElement.selectNodes("xpath"); in the source. I see later down there is also a foo.transformNode. Yuck. Has someone written a x-browser selectNodes/transformNode implementation so that I can get this code working in a non IE browser??
1
2451
by: Jazper | last post by:
hi i have a problem querying a simple atom-feed by xpath using the XmlDocument. i'm googleing for hours now and can't get a solution: --- Code --- XmlDocument doc = new XmlDocument(); doc.Load(XmlReader.Create(_feed.AbsoluteUri)); XmlNodeList list = doc.SelectNodes("feed"); // list.Count is always 0
0
9812
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9658
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10828
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10534
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7775
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6975
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5814
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4444
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4004
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.