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
3
votes
1 answer

Why doesn't lxml allow relative XPath expressions on the whole ElementTree?

Running Python 3.7.4 on Windows, I notice that XPath evaluation differs from the results of online evaluators, such as here or here. Online evaluators allow entering a relative expression, which will be evaluated on the entire document. However,…
3
votes
2 answers

How to find an element which contains   using Selenium

By Company   I need to capture xpath of the above element. I tried following alternatives, but nothing seems to be working in chrome. Can you please suggest any other option. "//td[normalize-space(text())='By…
Yogi
  • 73
  • 3
  • 9
3
votes
2 answers

How to locate and click "speed test" link on netflix using selenium in python?

I'm a complete beginner with selenium, sorry if the question is dumb (it is dumb):) I need to find Speed test link on https://www.netflix.com/ and then click it. i've tried searching by text and some other options. But nothing seems to work, I don't…
3
votes
1 answer

Extract measurements from XML nodes

I'm parsing large XMLs using Java 8 and XmlPath 1.0. I want to extract, name of the Test, his measured values and the outcome (Passed or Failed). Each Test can have many TestResult which contains one of the two types of limits: SingleLimit, which…
nanomader
  • 410
  • 9
  • 22
3
votes
5 answers

Selenium how to determine if element has child?

I am using Selenium via c#. I use this XPath to get all the children elements element.FindElements(By.XPath("./child::*")); Although if there is no child, it throws an error after a timeout. I am looking for a simple way to determine if it has a…
delex
  • 201
  • 1
  • 5
  • 13
3
votes
1 answer

How do I extract any text preceding a certain node using XPath 1.0?

I need a single XPath expression to select any text preceding a node, regardless of the structure and hierarchy. For example, how do I extract text before the node in the following cases: Case 1: 1 2 Expected…
Cuder
  • 163
  • 2
  • 8
3
votes
2 answers

How to pass variable parameter into XPath expression?

I want to pass a parameter into an XPath expression. (//a/b/c[x=?],myParamForXAttribute) Can I do this with XPath 1.0 ? (I tried string-join but it is not there in XPath 1.0) Then how can I do this ? My XML looks like val1
user2694734
  • 401
  • 2
  • 7
  • 14
3
votes
3 answers

Short hand for number of tags having lengthier [and almost same] Xpath

For example : this is an xslt
Rookie Programmer Aravind
  • 11,952
  • 23
  • 81
  • 114
3
votes
1 answer

Count Distinct Content in XPath 1.0

Given the following XML
France
...
Germany
...
Spain
How can I count the number of distinct countries…
Splic
  • 298
  • 3
  • 8
3
votes
2 answers

Selecting top N elements

Assuming we have such a structure (the number of b in every a is unknown): How would we express the following phrase in xpath: "top 4 b elements nested into a" The…
zerkms
  • 249,484
  • 69
  • 436
  • 539
3
votes
2 answers

Select nodes containing mixed content or just text with XPath

Using XPath 1.0 and XSLT 1.0 I need to select direct parents of mixed content or just text. Consider the following example:
Mixed
hielsnoppe
  • 2,819
  • 3
  • 31
  • 56
3
votes
3 answers

Aggregate-function for sum and product in XPath

Similar to this question (http://stackoverflow.com/q/1333558/948404) I want to use XPath to calculate a sum over products in a structure like this: 1.0 3
hielsnoppe
  • 2,819
  • 3
  • 31
  • 56
2
votes
2 answers

XPath: multiple predicates vs logical And operator

When we have multiple terms to locate an element we can use a single predicate with logical and operator inside it or to use multiple predicates with single term inside each predicate. For example on this page we can locate links to questions…
Prophet
  • 32,350
  • 22
  • 54
  • 79
2
votes
2 answers

how to use substring-after() and substring-before() with 'and' and 'or' operators in multiple strings

im trying to take substring of a element with xpath,
color : blue
color - green
jasmine flower
td tag contains the color values blue and green seperated by a hyphen or a…
2
votes
0 answers

Pyspark SQL - How to explode XML for same element with different index attribute

I have table in Hive which contains column with xml string: Jane Doe 30 111 333 444
Martin
  • 39
  • 5
1 2
3
27 28