xpath

Retrieving the text parts of a xpath node() value

I've created an xpath expression as follows: /html/body/div[2]/div/ul[2]/li/a/node() It returns something like this: #01 <strong>value</strong> suffix How do I extract the "#01" part and the "suffix" part in two different xpath expressions? ...

jquery: selecting xpath or converting xpath to css ?

i need to select based on xpath , or convert xpath to css. is there a plugin or built in function. ex. $('/html/body/div/a[4]').each .... ...

ruby, libxml getting the child nodes that match an xpath

I need to get the child nodes of a node using XPath as I want to "drill down" into a node. Here's the code I'm trying: xml_ns = 'Document:http://www.google.com/books/' xml_document = XML::Document.file('./test_pages/test.xml') book_xpath = '//Document:View/Document:Books' book_title_xpath = '//Document:Title' xml_document.find...

Can't read xml through XPathNavigator

Here is my code, I don't know why I can't read the data through XPathNavigator. But it was well before I add namespace and schema. XmlReaderSettings settings = new XmlReaderSettings(); settings.Schemas.Add("http://www.somewhere.com", schemaPath); settings.ValidationType = ValidationType.Schema; XmlRe...

XPath expression exception

Hi I am not really sure if i am doing this right with XPath expression. I am trying to locate a text on DOM and this text is assingned to a variable. I have text stored in SQLite and i have retrievd the text and i am trying to locate it on the webpage which actually contains the text. so i ahve the following code: var searchText = dat...

Problem with upper-case and lower-case xpath functions in selenium IDE

Hi, I am trying to get a xpath query using the xpath function lower-case or uppper-case, but they seem to not work in selenium (where I test my xpath before I apply it). Example that does NOT work: //*[.=upper-case('some text')] I have no problem locating the nodes I need in complex path and even using aggregated functions, as long as ...

How to query for rows along with their xml representation?

I need something like select * from tb_listings for xml auto But I need every row to be separate, and not one big xml document. I have tried something like the following: select id, (select * from tb_listings a where a.id=id for xml auto) as xmldata from tb_listings Expected output is like: id xmldata ------------------...

WPF XPath Binding With Multiple Results Converted to Comma-Delimited String

I have an XML file similar in structure to the following: <Parent> <Child>5</Child> <Child>3</Child> <Child>5</Child> <Child>1</Child> </Parent> In my XAML, I have a ListView bound to the XML file and have set the DataTemplate of a ListViewItem to be bound as follows: <TextBlock Text="{Binding XPath=Parent/Child}"/> ...

xsl:template match for xml with prefixes

I have this xml file <?xml version="1.0" encoding="UTF-8"?> <bo:C837ClaimParent xsi:type="bo:C837ClaimParent" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bo="http://somelongpathHere/process/bo"&gt; <claimAux> ... </claimAux> <enterpriseClaim> ... <patientAccountNumber>data to capture here</patientAccountNumbe...

How do you handle malformed HTML in Perl?

I'm interested in a parser that could take a malformed HTML page, and turn it into well formed HTML before performing some XPath queries on it. Do you know of any? ...

C# - XPath-Question: How to get Nodes under a specified parent-node?

Hi there, I`m new to Xpath and got a problem. I want all nodes under a specific parent-node! I tried it with this query, but only get an empty result! :( var ISDN_confs = from x in xdoc.XPathSelectedElements("//member[name='participantOne']//member[name='name']") select x; Sample XML: <methodResponse> <params> <p...

How to add times in XSLT?

Hello, I have some output from 3rd party software: Sample XML from the software: <testsuite name="XYZ"> <testcase name="ABC" status="0" time="12.001">Some stuff</testcase> <testcase name="DEF" status="0" time="12,345.001">Some stuff</testcase> <testcase name="GHI" status="0" time="4,321.001">Some stuff</testcase> ...

XAML support for local-name() in XPath

I'd like to bind to the element name of a node in my XmlDataProvider. I can't seem to get local-name() to work within my XPath expression. Does XAML support local-name()? <TextBlock Text="{Binding XPath=local-name()}" /> ...

c# xpath with an OR

I have the following XML: <users> <user> <location>ny</location> <status>1</status> </user> <user> <location>nj</location> <status>1</status> </user> <user> <location>pa</location> <status>50</status> </user> </users> What I actually need is all users in ny or nj who also have a status of 1. Based on the previous a...

for-each no results text

I have a for-each and when there is nothing output by it I would like to display some default text. If I have... <xsl:for-each select='xpath'> Some content for each matching element result. </xsl:for-each> What I would like is: <xsl:for-each select='xpath'> <xsl:output-this-when-there-is-content> Some content for each matching el...

need xpath selector plugin for jquery

i need to be able to select Xpaths in jquery. selecting via CSS is difficult for form elements with name, value, type, not to mention traversing down the tree. ...

need a javascript or jquery library to convert xpath to selectable CSS3 format in jquery

how can i convert xpath like /html/body/div[3]/ul/li[1]/a[5] html > body > div[3] > ul > li[1] > a[5] i believe, index is not supported with CSS3 selectors....so how to deal with this ? ...

Replacement for saxon:if and saxon:before functions in xslt 2.0

Is there any replacement for saxon:if and saxon:before functions in XSLT 2.0 / XPath 2.0? I have code like this: <xsl:variable name="stop" select="(following-sibling::h:h1|following-sibling::h:h2)[1]" /> <xsl:variable name="between" select="saxon:if($stop, saxon:before(following-sibling::*, $stop), ...

Xpath - How to select parent based on attribute of child?

How do you select a parent based on the attribute of a child? I want to select a div: //*[@id='outer']/div/div/div/div that has a child with the 'a href' attribute equal to 'www.blah.com': //*[@id='outer']/div/div/div/div/a[@href='www.blah.com'] ...

Is xsl:sequence always non-empty?

I don't understand output from this stylesheet: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; <xsl:template match="/"> <xsl:apply-templates select="root/sub"/> </xsl:template> <xsl:template match="sub"> <xsl:variable name="seq"> <xsl:sequence select="*" /> ...