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

org.openqa.selenium.InvalidSelectorException: invalid selector SyntaxError: Unexpected token } using XPath through Selenium Java

I'm trying to click the last span element in the following HTML
fugasjunior
  • 461
  • 1
  • 6
  • 22
2
votes
4 answers

How to get text in span with xpath. selenium python

Before asking, I find answer through google for 2hours. But there's no answer for me. I use selenium with python I apply below q/a answer to my code but nothing text printed. XPath query to get nth instance of an element What I want to get is "Can't…
user11211747
2
votes
2 answers

Python Selenium XPATH with multiple tags

I have an automated python script to check for any changes in the DOM. I have a xpath that works: //td[@class='high-bg']/a[@class='link-action'][@data-hintbox='1'][@data-hintbox-static='1'][@role='button'][@href='javascript:void(0)'] But it gives…
Montė Čiuklys
  • 48
  • 1
  • 2
  • 9
2
votes
2 answers

XPath trouble with Selenium

I guess it is one of those eternal questions, but I need some assistance with an XPath-expression. The HTML searched with Selenium looks like this:
ElToro1966
  • 831
  • 1
  • 8
  • 20
2
votes
1 answer

Select all deepest nodes with XPath 1.0 containing text, ignoring markup

I want to extract elements from the HTML page, containing text, ignoring markup. For example, I want to extract node containing the text "Run, Sarah, run!" from https://en.wiktionary.org/wiki/run. I know about node test text() and function string().…
rominf
  • 2,719
  • 3
  • 21
  • 39
2
votes
2 answers

XPath Get Value based on sibling value - with namespace

There are lots of answers with no namespaces involved but I'm having trouble with the namespace. Here's the xml doc:
Rob Bowman
  • 7,632
  • 22
  • 93
  • 200
2
votes
1 answer

Selecting only distinct values using XPath 1.0

How would I return only the unique City value where the Name of the state = 'Washington' using XPath 1.0? Washington Seattle Starbucks
2
votes
2 answers

XPath to select string value of element but with
replaced with newline?

Is it possible to call xpath normalize-space() on html with displaying
,
as new line? XPath version is 1.0 We parse articles from websites. Example of real HTML code:
Artem Dumanov
  • 381
  • 2
  • 21
2
votes
2 answers

Concatenate variable number of element string values via XPath 1.0?

I'm trying to use XPath 1.0 to select all of the text within these li elements, except for the last one with class="detailCrumb". I'd like my result to look like: Home Photography Memory Cards & Accessories Memory Cards These breadcrumbs will…
tsb8m
  • 75
  • 7
2
votes
1 answer

XPath 1.0: List distinct values with number of their occurrences

I'm generating a report that pulls information from an XML file. A B
Matt Furr
  • 53
  • 4
2
votes
1 answer

XPath function on multiple text nodes

Using XPath 1.0 want to get list of text nodes applying XPath 'substring' function on every text node substring(//p/text(), 10) gives only one first text's sub-string, when //p/text() gives all of them, but want all sub-strings as…
2
votes
2 answers

Can I refactor to avoid "self::" and "parent::"?

I want to extract //pre and //code elements but exclude //pre/code. For example:
foo
bar
baz
ignore meselect me
I want to retrieve four…
ᴇʟᴇvᴀтᴇ
  • 12,285
  • 4
  • 43
  • 66
2
votes
1 answer

XPath 1.0: Use the attribute value of the current node's parent to find another matching node

I have found many similar posts to this question, but nothing that answers this specific question. I must use XPath 1.0. I do not have XSLT (or XQuery or anything else) available to me, and I cannot use XPath 2.0. I am executing this XPath from…
T. Carano
  • 47
  • 7
2
votes
2 answers

In XPath 1.0, how can I test whether a string with length 1 falls between two others codepoint-wise?

Given a document containing these tags, how can I tell whether " " < "H" < "z" in the document's encoding? I'm trying to do this in XPath 1.0. H z I might even be able to get away with…
Telejester
  • 23
  • 2
2
votes
1 answer

xpath: Trim spaces in a node

I have an xml which is processed thru a java based sistem. if any node on the xml contains a space the process will hang or error out. so if i have this example how can i eliminate the spaces around the text nodes? It is important to mention that…
Paulo Robles
  • 23
  • 1
  • 3