xpath

Java xpath selection

I'm having a little trouble getting values out of an XML document. The document looks like this: <marketstat> <type id="35"> <sell> <median>6.00</median> </sell> </type> <type id="34"> <sell> <median>2.77</median> </sell> </type> </marketstat> I need to get the median where type = x. I've a...

Add two hexBinarys with XPATH 1.0

Hi, my xml document looks somewhat like that (Values are both xsl:hexBinary): <Offsets> <Offset> <Name>ErrorOffset</Name> <Value>DD</Value> </Offset> <Offset> <Name>OtherOffset</Name> <Value>FF</Value> </Offset> </Offsets> <Value> <Name>Error1</Name> <Code>0...

XPath to find an element with a similar sibling

Suppose I have this XML: <x> <e a='1' b='A'/> <e a='1' b='B'/> <e a='1' b='A'/> </x> I'd like to write an xpath to find any elements e which: Have attribute @b = 'A' Have the same value for attribute @a The xpath can't reference the literal value of attribute @a, however. It can reference the literal value of attribute...

XPath to compare two distinct attributes of two elements

Suppose I have this XML: <x> <e s="1" t="A"/> <e s="2" t="A"/> <e s="1" t="B"/> </x> Is there any way to write an xpath to find whether there are two distinct nodes named "e" which have the same value for @s but different values of @t. The first part is easy: //e[@s = //e/@s] as is the second part: //e[@t != //e[@t]] But I don'...

XSL - Get attribute of previous element

In the if block below I want to be also test whether @Timestamp is smaller than the previous Message's timestamp. How can I achieve this? <xsl:for-each select="Message"> <xsl:sort select="position()" data-type="number" order="descending"/> <xsl:variable name="newclass"> <xsl:if test="@Timestamp + 60 &gt; $ctimestamp">ne...

Does a method exist to check whether a string is a valid xpath?

I'm looking for a quick and easy method to check if a given string is a valid xpath. Does anybody know if something like this exists? Thanks, helixed ...

How can I handle an empty namespace with XDocument.XPathEvaluate?

I'm trying to use XDocument and XPathEvaluate to get values from the woot.com feed. I'm handling other namespaces fine, but this example is giving me problems. <rss xmlns:a10="http://www.w3.org/2005/Atom" version="2.0"> <channel> <category text="Comedy" xmlns="http://www.itunes.com/dtds/podcast-1.0.dtd"&gt; </cate...

Transform RSS-Feed into another "standard" XML-Format with PHP

Hey friends, quick question: I need to transform a default RSS Structure into another XML-format. The RSS File is like.... <?xml version="1.0" encoding="UTF-8"?> <rss version="2.0"> <channel> <title>Name des RSS Feed</title> <description>Feed Beschreibung</description> <language>de</lang...

Error when using axis with xpath query in IE

Hi, When using XPath expression "descendant::div" with selectNodes in IE i am getting an error "Expected token 'eof' found ':'". Is there something i am missing here, please help me get around this issue. Best Regards, Keshav ...

Choose a XML node in SQL Server based on max value of a child element

I am trying to select from SQL Server 2005 XML datatype some values based on the max data that is located in a child node. I have multiple rows with XML similar to the following stored in a field in SQL Server: <user> <name>Joe</name> <token> <id>ABC123</id> <endDate>2013-06-16 18:48:50.111</endDate> </...

I need a way to implement the function matches() from XPath 2.0 with functions from XPath 1.0

I have the following piece of code: root="//valueExpression[matches(self::*,'pattern')]/.." But I can only use XPath 1.0 and I get an exception for the function matches(). Can you please help me with a solution using only functions from XPath 1.0 ? ...

Using XSLT to find nodes given a set of parameters

Sorry about the title — wasn’t sure how to word it. Basically I have some XML like this: <countries> <country handle="bangladesh"/> <country handle="india"/> <country handle="pakistan"/> </countries> And some XSLT like this (which doesn’t work): <xsl:template match="/countries"> <xsl:param name="popular"/> ...

What's wrong with this XPath?

Hi, I have this XML: <rootCategories> <category id="1"> <category id="2"> <category id="3"> <category id="4" /> <category id="5" /> <category id="6" /> </category> <category id="7" /> </category> </category> </rootCategories> A...

Get data from XML in Android?

I have tried to use xpath in Android 1.5, but it does not seem to work? Could someone please tell me the best practice on retrieving a value from XML in this case? If you have any worked through examples, that would be a real help! Also, my XML is as a string, so I will need to convert it to be an xml document resource? ...

Get the full path of a node, after get it with an XPath query in JavaScript

Hi, i have the next instruction, in JavaScript: var firstScene = document.evaluate('//Scene', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null); so my question is how to get the full path of the node firstscene? ...

Can DocumentNode.SelectSingleNode skip selection of anchor tag events?

Given the following... HtmlNode myDiv = doc.DocumentNode.SelectSingleNode("//div[@id='someid']"); ...where the resulting myDiv.InnerHtml contains: <span>...other content I want to consume...</span> <a href="http://www.somewhere.com" onmousedown="return somefunc('random','parm','values','SHXA213')">Click Me</a> <span>...and more conte...

how can i get the same name child text using xslt?

source: <article> <title>title1</title> <description>des1</description> <child> <children> <subarticle> <title>subtitle11</title> <description>subdes11</description> </subarticle> </children> <children> <subarticle> <title>subtitle12</title> <description>subdes12</description> </subarticle> ...

XPath query on node-set working like a SQL where in

Hi, a sample of xml document: <xml> <list> <item refid="1" /> <item refid="3" /> </list> <catalogue> <model id="1"><details /></model> <model id="2"><details /></model> <model id="3"><details /></model> </catalogue> </xml> I'd like to query something like //model[ @id = (//item/@refid...

Regular Expressions in match attribute

Hello. I just want to know if it's possible to use regular expressions in the match attribute of the template element. For example , suppose i have the follow xml document: <greeting> <aaa>Hello</aaa> <bbb>Good</bbb> <ccc>Excellent</ccc> <dddline>Line</dddline> </greeting> Now the xslt to transform the above document:...

xpath for link in html by using the label of the link?

HI lets say i have a link that can not be identified in my html page like so: <a href="/somthing/confirm_delete_somthing?&id=12">Delete this monitor</a> can we have a xpath repersenting the link using the Delete this monitor label? somthing like //a[@label="Delete this monitor"] thanks ...