Re: [xsl] XPath discovery tool?

Subject: Re: [xsl] XPath discovery tool?
From: Liam R E Quin <liam@xxxxxx>
Date: Sun, 25 Apr 2010 13:03:32 -0400
On Sat, 2010-04-24 at 20:09 -0400, cknell@xxxxxxxxxx wrote:
> I have a number of XML-formatted Excel workbooks from which I wish to
> extract data. While the procedure for determining the XPath to any
> particular cell's value is not difficult, it is tedious. Does anyone
> know of a tool into which I could load the XML file, select an
> element, and automatically display the XPath to that element?

Several others have given answers - most XML editors can do this, or
you can use XSLT for example.

You might also want to see if your spreadsheet has a facility to give
a name to a specific cell, to get a simpler or more predictable
expression. or see what "insert comment" does to the XML file, or
temporarily put specific data in the cell, to see where it comes out
with one or other of the stylesheets that were just posted.

If you are fetching the values of _all_ the table cells, however (and
this is really why I'm writing) consider using apply-templates instead
of value-of, and you may not need the XPath expressions.

I often see XSLT with just one template for / and then lots of XPath
expressions used to find sub-elements - in many cases, rewriting to
use apply-templates leads to a much clearer and shorter stylesheet.

This may or may not work for your case, of course.

Best,

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

Current Thread