xpath: how to select nth option ?
using xpath, how do you select the n-th option ? <select> <option></option> <option></option> </select> /html/body/select/option[?] ...
using xpath, how do you select the n-th option ? <select> <option></option> <option></option> </select> /html/body/select/option[?] ...
Hi, I need to create an XSLT which tranforms an attribute in the source xml to a new element in the target xml with the element name assigned the "Name" value of the attribute in the source xml. Eg: Source: <ProductType>Fridge</ProductType> <Features> <Feature Name="ValveID">somename</Feature> <Feature Name="KeyIden...
Hello! I'm testing a web page using selenium. I want to get all the 'leaf elements and elements which contain text'. I use the following working XPath. //*[. != '' or not(*)] This works great. But now I want to loop through each of these elements and run some command on them. I actually want to get their Position, but I illustrate ...
I'm attempting to parse XML in the following format (from the European Central Bank data feed) using libxml-ruby: <?xml version="1.0" encoding="UTF-8"?> <gesmes:Envelope xmlns:gesmes="http://www.gesmes.org/xml/2002-08-01" xmlns="http://www.ecb.int/vocabulary/2002-08-01/eurofxref"> <gesmes:subject>Reference rates</...
Using XPath and the HTML Agility Pack, I need to select the destination text using color:#ff00ff. My HTML looks like this: <table> <tr style="color:#ff00ff"> <td></td> </tr> <tr> <td>destination</td> </tr> <tr> <td></td> </tr> <tr> <td>not destination</td> </tr> </table> ...
for example i have an xpath and wish to add a comment near it to identify it. /html/body/div/table/tr/td/a{this is a link} ...
Hi all. I'm trying to display (using a asp:Repeater and a asp:XmlDataSource) the content of a sitemap.xml file (see standard defined into http://www.sitemaps.org/protocol.php). The problem is that the binder <%#XPath("myNodeName")%> can't work when the source xml document contains custom namespaces (like required by the standard that d...
This is my problem: The code snippet below (inside the <xsl:choose>) does not reliably strip <p>, <div> or <br> tags out of a string using a combination of the substring-before() and substring() functions. The string I'm trying to format is an attribute of a SharePoint SPS 2003 list item - text inputted via a rich text editor. What I i...
Can someone explain to me what is nodeValue in this and write out how nodeValue look like or write out what's in nodeValue? EDIT: Sorry! Yes, this is PHP. And.. foreach ($elements as $e) { echo $e->nodeValue; } What does the arrow thingy mean (->)? That's an array right? Well if you can explain to me this one part that would be gre...
I have an XML document with a section similar to the following: <release_list> <release> <id>100</id> <file_list> <file> <id>20</id> </file> <file> <id>21</id> </file> </file_list> </release> <release> <id>101</id> <file_list> <file> <id>22</id> </file...
I've written a C++ wrapper function for libxml2 that makes it easy for me to do queries on an XML document: bool XPathQuery( const std::string& doc, const std::string& query, XPathResults& results); But I have a problem: I need to be able to do another XPath query on the results of my first query. Currently I do this by s...
I am new to Umbraco CMS. PLease help. I have a Umbraco website in which I created a DocumentType called 'Master'. The 'Master' page lets user input a goal and amount for a fund raising initiate they are undertaking. On the 'Master' page I have a Macro which automatically does the math to generate a percent that will be used throughout...
how can i express in xpath a) need select elements which contains specified keyword. (how to make it case insensitive?) z/x/c/v/a[normalize-space(text())='keyword'] b) need to select elements which contains any of given text() (case insensitive?) z/x/c/v/a[normalize-space(text())='keyword|keyword2|keyword3'] Lastly, a) how to exp...
I have XML in the following format which I want to reformat: <blocks> <!-- === apples === --> <block name="block1"> ... </block> <!-- === bananas === --> <block name="block2"> ... </block> <!-- === oranges === --> <block name="block3"> ... </block> </blocks> My problem is I can't figu...
Example, if I have <form name="blah"> <input name="1"/> <input name="2"/> <table> <tr> <td> <unkown number of levels more> <input name="3"/> </td> </tr> <table> </form> How can I put together a query that will return input 1,2 and 3? Edit: I should note I'm not interested i...
Hey All, I've got some XML elements with a number attached as more are available. Such as this: <Images> <Image1>C:\Path\To\AnImage</Image1> <Image2>C:\Path\To\AnotherImage</Image2> </Images> The amount of Images in each XML doc is variable. How can I make sure that my XSL file will show all elements inside the tag? I al...
Is there a way to limit the depth DOMXPath::query will look at? Consider the following document: <div> <span> <div> </div> </span> </div> How could I limit the query //div So it only matches the first level and not the descendants? ...
Hey I have just started to use Python recently and I want to use it with a bit of xPath, the thing is when I print the result of the query I only get [] and I don't know why =S import libxml2, urllib doc = libxml2.parseDoc(urllib.urlopen("http://www.domain.com/").read()) result = doc.xpathEval("//th//td[(((count(preceding-sibling:...
I have an xml file like this: <students> <student name=....> </student> <student name=....> </student> <student name=....> </student> <student name=....> <failedcourses> ... </failedcourses> </student> <student name=....> <failedcourses> ... </failedcourse> </student> </students> I.e. I have a list ...
I've tried reading various tutorials online but I can't make any headway on solving this issue which is easy to describe but which I can not conceive of a solution. Here is some sample XML: <AAA> <BBB> <CCC>1</CCC> <CCC>2</CCC> </BBB> <BBB> <CCC>3</CCC> <CCC>4</CCC> </BBB> </AAA> I want...