xpath

is this a valid xpath and if so what does it mean ?

/html/body/input[@id='query' and @name='query' and @value='Search Text'] ...

XPath and XSLT 2.0 for .NET?

.NET 3.5 doesn't completely support XPATH 2.0 or XSLT 2.0, which is just too bad. Does anyone know if these two will be included and fully supported in any future .NET versions? ...

C# Regex. This regex doesn't quite do the job.

I'm trying to split these into tokens and it's mostly there. I really want to split the primary tokens up like NIGHT, set, the xpath pattern, the value to assign to the xpath pattern, i.e. in the second one, 'high' and in the second one, 'taken-offline' and the '-' and '+'. NIGHT.set('.//idmef:Source[1]','+') NIGHT.set('.//idmef:Assess...

How to reference an XML attribute using XPath?

My XML: <root> <cars> <makes> <honda year="1995"> <model /> <!-- ... --> </honda> <honda year="2000"> <!-- ... --> </honda> </makes> </cars> </root> I need a XPath that will get me all models for <honda> with year 1995. so: /root/cars/makes/honda But how to reference an ...

JTidy upgrade broke document xpaths

I just updated to the newest version of jtidy which came out in october and it seems to have broken my document object for unknown reasons. This is my code: tidy = new Tidy(); tidy.setShowWarnings(false); tidy.setShowErrors(0); tidy.setQuiet(true); tidy.setMakeClean(true); URL url = new URL(url_string); Document doc = tidy.parseDOM(url...

Weirdness when clicking span elements

I have a FAYT input I'm checking. I type in the textbox, see the options unfold and click one of them. All this passes neatly but there is something in the process that fails because the selected category is not selected. (this feature works like a charm when you try it manually) This is the outline of the drop down suggestions' html: ...

printing a count with XSLT

I have an XML file which I'm trying to transform into XHTML using a XSLT file. I was wondering if it's possible to get a count of the number of times a template has been invoked. This is my XML: <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" encoding="UTF-8" href="car.xslt" version="1.0"?> <vehicle> <car> ...

can i use xpath to set values to elements?

can i use xpath to set element properties ? /html/body/form[@id='search']/select[@name='category' and @value='apple' and @type='select-one'] ...

xpath for selecting <option> html tag ?

xpath for selecting html tag ? <select> <option value="first option"> 1 </option> <option value="second option"> 2 </option> <option value="third option"> 3 </option> </select> Would below suffice ? html/body/form/select[@name='options' and @value='first option'] ...

Xpath to get a child node value

How can I get the values of all nodes called "title" from the XML below ? <bookstore> <bookA> <title> Title Book A</title> <desc> Book A </desc> <bookA> <bookB> <title> Title Book B</title> <desc> Book B </desc> <bookB> </bookstore> Thanks ...

What's the difference between //node and /descendant::node in xpath?

I use a lot of XPath when locating elements in web pages using Selenium, and have moved away from using node1//node2 towards using node1/descendant::node2 more recently. What's the difference between the two methods? Is one more efficient than the other? Example XML snippet to demonstrate: <div id="books"> <table> <tr><td class="...

how can you express multiple <options> in xpath ?

for multiple selectdown form, how can you express multiple options selected ? <select name="sweets" multiple="multiple"> <option>Chocolate</option> <option selected="selected">Candy</option> <option>Taffy</option> <option selected="selected">Caramel</option> <option>Fudge</option> <option>Cookie</option> </se...

how to merge element using xslt?

I have an reference type of paragraph with element. Example Input file: <reference> <emph type="bold">Antony</emph><emph type="bold">,</emph> <emph type="bold">R.</emph> <emph type="bold">and</emph> <emph type="bold">Micheal</emph><emph type="bold">,</emph> <emph type="bold">V.</emph> <emph type="italic">reference title</emph></refer...

xPath in Selenium - what am I doing wrong?

I have a page with the following snippet in the HTML: ... <tbody id="c_scopePane4_tbody"> <tr id="c_scopePane4_tr_header"> ... </tr> </tbody> ... Now I'm trying to specify the <tr> tag with an XPath expression from within Selenium. Here's what I try: //tr[@id='c_scopePane4_tr_header'] This tells me [error] locator not found: //t...

How do I retrieve an XML Element where an attribute is either X or Y?

Consider this xml: <parent> <child name="alpha" /> </parent> and also this xml <parent> <child name="beta" /> </parent> There should be only a sinlge node at /parent/child with either alpha or beeta as it's name value. To clarrify... there will never be 2 child nodes one each named alpha and beta I'm trying to create a si...

Xpath in XSLT: select elements that are between 2 other elements, part II

As similar to this question (there are more related entries, however as a new user I can only post one URL): http://stackoverflow.com/questions/1489326/xpath-get-elements-that-are-between-2-elements I have a question regarding the selection of set of elements that occur between 'other / delimiting' elements. This situation occurs when t...

possible to select multiple options with xpath ?

/html/body/form/select/option[@val = '1' and @val = '3'] so that means select the first and third option in a select-multiple form ? ...

Xpath: how to select an option based on its text not value property ?

consider both types: <select name="garden"> <option>Flowers</option> <option selected="selected">Shrubs</option> <option>Trees</option> <option selected="selected">Bushes</option> <option> Grass </option> <option>Dirt</option> </select> Is @val for actually indicating the...

Xpath: Selecting checkbox and radio's via it's inner Text...are my Xpath's correct ?

I find that sometimes, the value = "" is missing. So I am reverting to querying for the normalized inner Text. <label><input type="radio" name="addThree">A Radio</label> <label><input type="checkbox" name="hasPic"> A Checkbox </label> Here are the xpath's respectively...Are these correct? //label/input[normalize-space(text()) = "...

How do you use "not" in xpath

I want to write something of the sort: //a[not contains(@id, 'xx')] (meaning all the links that there 'id' attribute doesn't contain the string 'xx') I can't find the right syntax. Thanks ...