473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Nested XPath Search

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 4082
8,658 Expert Mod 8TB
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
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
8,658 Expert Mod 8TB
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
Thanks for your answer.
Feb 18 '09 #5

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

Similar topics

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...
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...
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...
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...
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...
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...
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...
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...
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...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
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...
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...
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,...

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.