Questions tagged [xpath-1.0]

Use this tag for questions specific to XML Path Language (XPath) version 1.0

W3C Recommendation:


Online Training

A 70-minutes "Crash Course in XPath" module is available as part of the Pluralsight video-course "XSLT 2.0 and 1.0 Foundations", by Dimitre Novatchev


410 questions
94
votes
6 answers

XSLT string replace

I don't really know XSL but I need to fix this code, I have reduced it to make it simpler. I am getting this error Invalid XSLT/XPath function on this line This is the…
Aximili
  • 28,626
  • 56
  • 157
  • 216
32
votes
6 answers

How can I use XPath to find the minimum value of an attribute in a set of elements?

If I have XML like: ... Can I use XPath to find the minimum and maximum values of score? Edit: The tool i'm using (Andariel ant tasks) doesn't…
brasskazoo
  • 76,030
  • 23
  • 64
  • 76
30
votes
8 answers

Encoding XPath Expressions with both single and double quotes

XPath (v1) contains no way to encode expressions. If you only have single OR double quotes then you can use expressions such as //review[@name="Bob's Pizza"] //review[@name='"Pizza" Pam'] But if you have BOTH e.g [Fred's "Fancy Pizza"] then you…
Ryan
  • 23,871
  • 24
  • 86
  • 132
16
votes
7 answers

How to find the max attribute from an XML document using Xpath 1.0

Is there a way to query an XML document to return the maximum of a given attribute using Xpath 1.0 ? For example is there a way to get the max id ?
HerbSpiral
  • 183
  • 1
  • 2
  • 8
16
votes
2 answers

How to select the nth item in xpath 1.0?

I have some XML and an XPath query. I'm using Yahoo! widgets, so I'm using XPath 1.0. Here's the gist of my XML... speak.swf 250
izb
  • 50,101
  • 39
  • 117
  • 168
11
votes
1 answer

How to use starts-with() , contains() and ends-with() in XPath to find the xml node innertext? in XPATH 1.0

Ethical standards and patient consent Ethical standards and patient standards and patient consent I want to get the inner text with start…
Karuppa Samy
  • 161
  • 1
  • 1
  • 9
10
votes
3 answers

Check type of node in XSL template

Is it possible to check the type of a node I matched with a template inside the same template? In case it is, how can I do it? For example I would like to do something like this:
hielsnoppe
  • 2,819
  • 3
  • 31
  • 56
10
votes
3 answers

XPath "in" operator

Is there is an operator in XPath 1.0 that acts as "in" operator in SQL? select * from tbl_students where id in (1,2,3)
Heba El-Fadly
  • 281
  • 1
  • 5
  • 17
9
votes
2 answers

Python and Selenium xpath for selecting with multiple conditions

I have the following code in selenium but continue to get a syntax error. I'm trying to select an element based on multiple conditions. choices = driver.find_elements_by_xpath("//div[contains(.,'5') and [contains(@class, 'option')]]")$ Thanks for…
Noah Ratliff
  • 197
  • 2
  • 2
  • 6
6
votes
5 answers

TypeError: Failed to execute 'evaluate' on 'Document': The result is not a node set, and therefore cannot be converted using Xpath through Selenium

Part of page source: Gi2/0/20 Parts of the code: from selenium import webdriver ... driver = webdriver.Chrome() ... IP_CLICK =…
yuzhu-chen
  • 63
  • 1
  • 1
  • 3
6
votes
2 answers

Xpath to select all and exclude child and its children

I have the Data below and I am trying to select all the nodes except RejectedRecords and all of its children. 10072014084945
camarokris
  • 345
  • 1
  • 3
  • 9
6
votes
5 answers

Is xpath different for different browser?

I am having a very funny issue. I am having a xpath through which i am retrieving value. Ex. System.out.print(driver.findElement(By.xpath("//*[@id='error-box']/ul/li")).getText().toString()); In firefox and Chrome it is giving same text while in…
OPTIMUS
  • 672
  • 4
  • 14
  • 29
5
votes
3 answers

using XPath to select contiguous elements with a certain attribute value

I have XML like this: 1 2 3 4 5 6 7 8 What I want is to use an XSLT stylesheet to put the…
ptomato
  • 56,175
  • 13
  • 112
  • 165
5
votes
2 answers

How to handle double quotes in string before XPath evaluation?

In the function below, when string in $keyword contains double quotes, it does create a "Warning: DOMXPath::evaluate(): Invalid expression": $keyword = 'This is "causing" an error'; $xPath->evaluate('boolean(//img[contains(@alt,…
Scott B
  • 38,833
  • 65
  • 160
  • 266
5
votes
1 answer

Concat function with strings in XPath

I am trying to get the complete address using XPath. I am new to XPath. This is what I have done so far:

2222 Warnar Ave USA,…

MTALY
  • 1,430
  • 2
  • 18
  • 26
1
2 3
27 28