473,791 Members | 3,137 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Nested XPath Search

3 New Member
I have been trying to accomplish to populate a list of nodes that corresponds to the conditional statement in javascript. I can now search only by project name, as shown in the statement below. However, I want to be able to filter the search by Project Name and Year, and so on. I know this can easily be accomplished in XSLT. Unfortunately, I can not use dynamic XSLT in Sharepoint. Is there any way that I can search my XML file based on multiple criteria?

Expand|Select|Wrap|Line Numbers
  1. myDoc.setProperty("SelectionLanguage", "XPath");
  2.   currNode = myDoc.selectNodes("/projects/item/Project_Name[contains(@value, '" + prName.value+ "')]");
Thanks in advance.
Feb 17 '09 #1
4 4093
Dormilich
8,658 Recognized Expert Moderator Expert
I don't know what you mean by "dynamic XSLT" but it should be possible to do a selection based on passed parameters.

looking at your example, you can extend it to more than one condition. like:
Expand|Select|Wrap|Line Numbers
  1. "path/to/element[condition_1][key = 'value'][another_condition != $anything]"
Feb 17 '09 #2
gorkemt
3 New Member
Thanks for your answer.
But I can query out only one element with multiple condition parameters. The problem is how I can use multiple elements in the xpath statement.
Such as:
"path/to/element1[condition_1][key = 'value1']" AND
"path/to/element2[condition_2][key = 'value2']"
Feb 17 '09 #3
Dormilich
8,658 Recognized Expert Moderator Expert
@gorkemt
that's only a matter of the conditions. you may as well get a node-set of several elements, depending on the XPath. admittedly, the XPath will get more complex to do so.

consider this:
Expand|Select|Wrap|Line Numbers
  1. //*[* = /path/to/element1 or * = /another/path/to/element2]
Feb 17 '09 #4
gorkemt
3 New Member
Thanks for your answer.
Feb 18 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
1730
by: Anon | last post by:
Hi, to not deceive you this is a school project. We are developing some XSLT to format some data in HTML for Internet Explorer. The work uses XSLT and CSS and XML. The objective is to write a search form, the user enters details in a browser window, presses the "search" button, and books that match the search criteria are displayed in a table formatted with pretty colours. We have a problem. We thought the XML searched by the...
1
6606
by: tom | last post by:
hello, i have seen multiple postings on the subject but no answer that addresses my question: I create a dataset using a xsd schema. the schema specifies a relation from one of the tables to the other table via a primary-secondary key on the tables. i load the data into the dataset.
1
2140
by: Jerry Collings | last post by:
I'm getting improperly nested xml when a column contains null. I modified the first row (customer ALFKI) to have a NULL Address column. I'm using the following XSD Annotated Schema against the NorthWind database: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:sql="urn:schemas-microsoft-com:mapping-schema"> <xs:element name="customer" sql:relation="Customers"
2
1627
by: kids_pro | last post by:
Hi there, When class construct it read content from XML file and store it in ArrayList. In my class I had implement Search method using BinarySearch behind. I want to implement another Method XmlSearch() to search direct from XML file. <dictionary>
37
2792
by: Tim N. van der Leeuw | last post by:
Hi, The following might be documented somewhere, but it hit me unexpectedly and I couldn't exactly find this in the manual either. Problem is, that I cannot use augmented assignment operators in a nested scope, on variables from the outer scope: PythonWin 2.4.3 (#69, Mar 29 2006, 17:35:34) on win32. Portions Copyright 1994-2004 Mark Hammond (mhammond@skippinet.com.au) -
1
2420
by: Sergey Dubinets | last post by:
In effort to prioritize our goals we composed the list of random features each of them may add value to set of XSLT tools offered from Microsoft. 1. XSLTc (Compiler for XSLT stylesheets, that generates .NET assemblies) 2. Performance improvements in the XslCompiledTransform
6
2015
by: Derek Hart | last post by:
I bring in an xml file into vb.net by using xmlDoc.LoadXml(XMLString) - I run xpath statements against the xml file to grab data from it, so I use, as an example, //Vehicles/Vehicles/@make to get the make of the car. But then I pass a specific node from xmlDoc into another function, not the whole xmlDoc, just a node from it. And if I run an xpath against it, I have to use .// (has a period at the beginning) so it does not grab info from...
1
3221
by: sql_er | last post by:
Hi all, I am trying to convert an SQL statement into an XPath (or a sequence of XPath) statements. More specifically, I have the following: SELECT a FROM b WHERE c IN (SELECT d FROM e) I recently learned about XPath and know how to perform simple filtering
1
1933
by: Datawich | last post by:
Hi. By persistence, I've discovered that when several nested elements in a schema are each qualified by a namespace, I can successfully reference them in a select statement by qualifying each element by its namespace in succession. For example, for a schema that qualfies each element in a nested series "command, heading, pivot table" by "xs", I can use an xpath statement like "//xs:command/xs:heading/ xs:pivotTable" to select the pivot...
0
9669
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
9515
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,...
1
10155
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9995
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9029
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5431
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5559
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4110
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
3718
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.