xpath

Generating WordML Reports Using Templates and XPath using ASP.Net

I need to know how we can Generate WordML Reports Using Templates and XPath using ASP.Net. What are its advantages. A Simple How To Tutorial is what I require. ...

XSLT max node value problem

Hi, I have a xml given below: <root title="الصفحة الرئيسة"> <item title="الصفحة الرئيسة" itemuri="tcm:8-29-4" ShowInNav="True" type="sg" pageuri="tcm:8-10592-64" sLink="/ara/index.aspx"> <item title="من نحن" itemuri="tcm:8-779-4" ShowInNav="True" type="sg" pageuri="tcm:8-9934-64" navorder="00500" sLink="/ara/about/index.aspx">...

Screen Scraping with PHP and XPath

Does anyone know how to maintain text formatting when using XPath to extract data? I am currently extracting all blocks <div class="info"> <h5>title</h5> text <a href="somelink">anchor</a> </div> from a page. The problem is when I access the nodeValue, I can only get plain text. How can I capture the contents including formatting, i...

WPF binding to XPath-reachable value of an element property

I'd like to bind to a value reachable only with XPath from the property of an element. The element is a ComboBox populated from some XML, and its property is SelectedItem. SelectedItem points to an XML element, and I'd like to bind to a child element's value within that, which can be reached with an XPath. The XAML looks like this, so ...

.NET: Possible to change XPath() expression based on URL parameters?

I'm setting up a simple page that just displays the contents of an XML file and allows the user to filter by keyword. I'm a serious .NET newb, but I've got an XmlDataSource set up: <asp:XmlDataSource ID="RSSFeedDataSource" runat="server" DataFile="test.xml" XPath="/rss/channel/item[contains(title,"theKeyword")]"></asp:XmlDataS...

get xpath from xsl variable

I am trying to get some xpath from xsl variable using xsl ver 1.0 . That’s my variable: <xsl:variable name ="myVar"> <RefData RefTag="test1" bbb="false" /> <RefData RefTag="test2" bbb="false" /> <RefData RefTag="test3" bbb="false" /> <RefData RefTag="test4" bbb="true" /> <RefData RefTag="test5...

XSL/XPath Indentation

What conventions (if any) do you use for indenting XSL code? how do you deal with really long, complicated XPaths can you plug them into your XML editor of choice? is there some open source code that does the job well? For some background, I use nxml-mode in Emacs. For the most part its OK and you can configure the number of spaces ...

Which XPathAPI should I use in Java 1.5?

I have been using com.sun.org.apache.xpath.internal.XPathAPI for some time and it seems to work ok. Recently I tried to use the TPTP profiler in Eclipse but it could not find the XPathAPI class. I haven't figured this problem yet but it did make me wonder whether I should be using a class in an 'internal' package? Should I be using the ...

What is the LINQ to XML equivalent for this XPath

I wondering what the "best practice" way (in C#) is to implement this xpath query with LINQ: /topNode/middleNode[@filteringAttribute='filterValue']/penultimateNode[@anotherFilterAttribute='somethingElse']/nodesIWantReturned I would like an IEnumerable list of the 'nodesIWantReturned', but only from a certain section of the XML tree, d...

Get the XPath to an XElement?

I've got an XElement deep within a document. Given the XElement (and XDocument?), is there an extension method to get its full (i.e. absolute, e.g. /root/item/element/child) XPath? E.g. myXElement.GetXPath()? EDIT: Okay, looks like I overlooked something very important. Whoops! The index of the element needs to be taken into account. S...

Select first instance only with XPath?

I am parsing some XML something like this: <root> <some_gunk/> <dupe_node> ... stuff I want ... </dupe_node> <bits_and_pieces/> <other_gunk/> <dupe_node> ... stuff I don't want ... </dupe_node> <more_gunk/> </root> An XPath of '//dupe_node' will give me tw...

Greasemonkey: XPath returns no results for .xhtml page

When running on an xhtml page, xpath doesn't seem to return any results. var result = document.evaluate( "//a/img", document.body, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null ); For example returns an empty result set. What's the problem here, and how do I fix it? ...

Using XPath: find link in cell 3 rows up

Hi Guys! I have multiple rows in a table, in one of which is a link I'd like to automatically click. For my starting point I have the last instance that a row contains the text "Test Question?": ID: 1416 Edit/Approve Ignore Email Name: Submitter Name Open N/A Location: Submitter Location ...

How do I select the last N elements with XPath?

I support a web site which generates content XML that is then translated into web pages using XSLT. I have been asked to create a new stylesheet which will transform the output of the "archive" page into Atom for syndication. The problem I'm running into is that the archive page contains a rather large number of items — 142 and countin...

XSLT: Efficient mapping of two large lists

I've been tasked with writing some XSLT 2.0 to translate an XML document to another XML document. I'm relatively new to XSLT but I have learn alot during the days I've do this. During this time I have had to map simple values, i.e. 002 -> TH etc. This has been fine for small lists of less than 10 values, I used xsl:choose. However I need...

Refering another element in XML

I'm trying to design an XML document structure for my application. I want to store a list of holes like following <Holes> <Hole id='1' dia='0.1' depth='2'/> <Hole id='2' dia='0.2' depth='1.67'/> <Hole id='3' dia='0.3' depth='0.44'/> </Holes> In another part of my document I want to refer to a hole by its id. e.g. <Drill useHoleWit...

What ever happened to XPathReader

XPathReader is/ was an implementation of a forward reading XML parser (built on XMLReader) which allowed you to register XPath queries for it to find (or at least a subset of XPath called Sequential XPath). This seems to be the perfect choice for easy access to elements of xml streams, or case where you just need to pull some information...

How to test for missing attribute in XSL?

What I have is following: <xsl:variable name="myvar" select=".//spss:category[((not @varName) or @varName=$colVarName) and @text=$series]/spss:cell/@text"/> What it should do is select the text of the spss:cell's text-Attribute as long as it is a child of a spss:category that has either a varName Attribute with a value equal to $col...

ORDER BY syntax with an XML column in SQL 2005

I have a user profile(more than one profile based on user type) which I'm storing in a DB column(xml). I can query on this using XPATH in my stored procedure, however I am unsure how to then perform an ORDER BY. SELECT U.UserId, UP.Profile, UP.UserParentID FROM aspnet_Users U LEFT OUTER JOIN UserProperties UP ON U.UserId = UP.UserId W...

XPATH Multiple Element Filters

I have the following sample XML structure: <SavingAccounts> <SavingAccount> <ServiceOnline>yes</ServiceOnline> <ServiceViaPhone>no</ServiceViaPhone> </SavingAccount> <SavingAccount> <ServiceOnline>no</ServiceOnline> <ServiceViaPhone>yes</ServiceViaPhone> </SavingAccount> </SavingAccounts> Wh...