xsl-list
[Top] [All Lists]

Re: [xsl] XPath discovery tool?

2010-04-25 12:03:57
On Sat, 2010-04-24 at 20:09 -0400, cknell(_at_)onebox(_dot_)com 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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>