473,396 Members | 2,037 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,396 software developers and data experts.

selecting tags by one of two attributes via xpath?

If I wanted to select all 'form' tags with an attribute of 'name'
being set to a specific value, I'd do this:

//form[@name=whatever]

What if, however, I wanted to select all 'form' tags with either an
attribute of 'name' or an attribute of 'id' being set to a specific
value?
Aug 18 '08 #1
2 3683
yawnmoth wrote:
If I wanted to select all 'form' tags with an attribute of 'name'
being set to a specific value, I'd do this:

//form[@name=whatever]

What if, however, I wanted to select all 'form' tags with either an
attribute of 'name' or an attribute of 'id' being set to a specific
value?
form[@name = 'foo' or @id = 'bar']
does a logical or. Do you really want an either/or?

--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 18 '08 #2


Martin Honnen wrote:
yawnmoth wrote:
If I wanted to select all 'form' tags with an attribute of 'name'
being set to a specific value, I'd do this:

//form[@name=whatever]

What if, however, I wanted to select all 'form' tags with either an
attribute of 'name' or an attribute of 'id' being set to a specific
value?

form[@name = 'foo' or @id = 'bar']
does a logical or. Do you really want an either/or?
Yup - want it to behave like <a name="..."or <a id="...">. For
either of those, page.html#... goes to the same thing. Not sure what
would happen if you had an <a name="..."and an <a id="..."with the
same value, but yeah - I do indeed want or. No particular preference
on whether or not it's inclusive or exclusive...
Aug 18 '08 #3

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

Similar topics

1
by: Alastair Cameron | last post by:
VB6, MSXML 3.2 installed: Q1. I am having a problem selecting nodes with XPATH expressions when an attribute values contain backslashes (\\) in as part of its value: For example the...
2
by: kj | last post by:
Suppose I have some XML document that contains tags of the form <... xmlns:foo="http://www.bar.org/foo"> <... xmlns:foo="baz"> <... xmlns:frobozz="http://www.bar.org/foo"> What's the...
2
by: Yang | last post by:
Hi everyone: after I parse a .xml file, I still have the xml tags in my varibles. Please help. Why my $title varible is " <title>title is here</title>" instead of "title is here"??? thanks...
1
by: Jenny | last post by:
Hi, Can I create an array of tags by assigning same name to these tags? For example, I have two <p> tags with the same name t1. But document.all.b.value=document.all.t.length does not...
12
by: Oberon | last post by:
I have a large HTML document. It has hundreds of <span>s which have no attributes so these <span>s are redundant. How can I remove these tags automatically? The document also has <span>s with...
1
by: Cheryl | last post by:
I have problems selecting the attribute when I use the SelectNode function. <book> <title store='7456' >Nutshell</title> <author id='1'>Drayton</author> <xauthor publish = "1" publishtime =...
1
by: Randall Parker | last post by:
I'm wondering if there are general rules for the use of HTML attributes with ASP tags? For example, one can set an id for an asp:DataGrid and it will show up as the id for the resulting HTML...
2
by: barbaraann | last post by:
I am new to dotnet and I am having trouble reading an xml file. "The expression passed to this method should result in a NodeSet." Here is my xml file: <?xml version="1.0"...
3
by: pjvleeuwen | last post by:
Hi all, For many of you this may be childishly simple, but the following problem keeps me wondering for almost two hours, so I hope any of you could point out what it is that I am doing wrong. ...
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...
0
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...

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.