Все вопросы: [xpath]

575 вопросов

похожие теги: xpath-3.0xpath-apixpath-1.0xpath-2.0
0
голосов
3ответов
1003 просмотров

xpath functions not supported in jquery

I have the following xpath that I need to run, but Jquery doesn't support the functions....so how can i actually make this work in jquery ? $("//*[br]/text()[string-length(normalize-space()) != 0]").each( ....

4
голосов
3ответов
3988 просмотров

PHP XPATH of HTML document omitting all tags. I want to keep them

I am parsing a HTML document with XPATH and I want to keep all the inner html tags. The html in question is a unordered list with many list elements. <ul id="adPoint1"><li>Business</li><li>Contract</li></ul> I am parsing the document using the following PHP...

1
голосов
1ответов
733 просмотров

XSLT - activate xpath function in XSLT

i have the following xml, which is the result of runnig xslt: <?xml version="1.0" encoding="UTF-8"?> <toc xmlns:fn="http://www.w3.org/2004/07/xpath-functions" label="Sample Table of Contents"> <topic label="Title1" href="Ref1#ref1"> <topic label="Title 2" href="R...

1
голосов
3ответов
1567 просмотров

Extracting info from html using PHP(XPath), PHP/Python(Regexp) or Python(XPath)

I have approx. 40k+ html documents where I need to extract information from. I have tried to do so using PHP+Tidy(because most files are not well-formed)+DOMDocument+XPath but it is extremely slow.... I am advised to use regexp but the html files are not marked up semantically (table based layout...

6
голосов
3ответов
10606 просмотров

Is it possible to use a Dynamic xPath expression in a xslt style sheet?

I'd like to use the value of an xslt parameter in an xpath expression. Specifically, as part of a not() call in an <xsl:if expression. <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!-- my_param contains a string '/foo/bar', passed in from ant --...

2
голосов
2ответов
605 просмотров

how to find all the child nodes inside the matched elements (including text nodes)?

in jquery its quite simple for instance $("br").parent().contents().each(function() { but for nokogiri, xpath, its not working out quite well var = doc.xpath('//br/following-sibling::text()|//br/preceding-sibling::text()').map do |fruit| fruit.to_s.strip end

6
голосов
1ответов
1854 просмотров

nokogiri: why is this an invalid xpath?

//br/preceding-sibling::normalize-space(text()) i am getting invalid xpath expression with nokogiri

164
голосов
4ответов
136687 просмотров

How to 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.

0
голосов
1ответов
1358 просмотров

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'...

26
голосов
2ответов
26493 просмотров

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> &lt...

6
голосов
3ответов
1695 просмотров

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 ?

1
голосов
2ответов
2225 просмотров

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): 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 tr...

1
голосов
2ответов
162 просмотров

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 n...

0
голосов
2ответов
1090 просмотров

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...

2
голосов
2ответов
2538 просмотров

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...

0
голосов
3ответов
207 просмотров

how can you express multiple <options> in xpath?</options>

for multiple selectdown form, how can you express multiple options selected ? &lt;select name="sweets" multiple="multiple"&gt; &lt;option&gt;Chocolate&lt;/option&gt; &lt;option selected="selected"&gt;Candy&lt;/option&gt; &lt;option&gt;Taffy&lt;/option&gt; &lt;option selected="s...

32
голосов
4ответов
49110 просмотров

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: &lt;...

1
голосов
2ответов
4395 просмотров

Xpath to get a child node value

How can I get the values of all nodes called "title" from the XML below ? &lt;bookstore&gt; &lt;bookA&gt; &lt;title&gt; Title Book A&lt;/title&gt; &lt;desc&gt; Book A &lt;/desc&gt; &lt;bookA&gt; &lt;bookB&gt; &lt;title&gt; Title Book B&lt;/title&gt; &lt;desc&gt; Book B &lt;/desc&gt; &lt;bo...

12
голосов
2ответов
21419 просмотров

xpath for selecting <option> html tag?</option>

xpath for selecting html tag ? &lt;select&gt; &lt;option value="first option"&gt; 1 &lt;/option&gt; &lt;option value="second option"&gt; 2 &lt;/option&gt; &lt;option value="third option"&gt; 3 &lt;/option&gt; &lt;/select&gt; Would below suffice ? html/body/form/select[@name='options' and @va...

2
голосов
4ответов
5519 просмотров

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']

2
голосов
3ответов
3199 просмотров

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: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;?xml-stylesheet type="text/xsl" encoding="UTF-8" hre...

0
голосов
1ответов
78 просмотров

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 out...

3
голосов
2ответов
1982 просмотров

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...

3
голосов
2ответов
7603 просмотров

How to reference an XML attribute using XPath?

My XML: &lt;root&gt; &lt;cars&gt; &lt;makes&gt; &lt;honda year="1995"&gt; &lt;model /&gt; &lt;!-- ... --&gt; &lt;/honda&gt; &lt;honda year="2000"&gt; &lt;!-- ... --&gt; &lt;/honda&gt; &lt;/makes&gt; &lt;/cars&gt; &lt;/root&gt; I need ...

0
голосов
1ответов
145 просмотров

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:...

91
голосов
5ответов
46086 просмотров

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?

0
голосов
4ответов
169 просмотров

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

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

0
голосов
1ответов
564 просмотров

how to make this javascript function output @value in the xpath?

The code below, produces Xpath. However, it doesn't display @value attribute/property. It is not working very well. function getXPath(node, path, val) { path = path || []; if(node.parentNode) { path = getXPath(node.parentNode, path); } if(node.previousSibling) { var count = 1; var sibling =...

0
голосов
2ответов
1179 просмотров

what does this xpath expression mean?

//input[@type="hidden" and @name="val" and position() = 1]/@value does this mean get the text typed inside the input box ?

1
голосов
1ответов
852 просмотров

expressing value of textbox in xpath?

how can i express the value of a textbox in xpath ? the text that was just typed into the textbox. so if i type apple inside a textbox, i need to output the value of this in xpath.