# XML nodes for Calc spreadsheet

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I ask for a cheatsheet of XML relevant nodes of a Calc spreadsheet.

Why? I am trying to write an XSLT filter from a Calc spreadsheet in order to produce clean no-styling HTML5 output with column names as data-attributes and as part of tags attributes. Something like this (the extra CSS is also needed):

   A        B        C
1 title1  title2  title3
2 numer string  date
3 data1  data2 data3
4 data4  data5 data6

<html>
<body>
<table>
<tr>
<td data-title="title1" class="numeric">data1</td>
<td data-title="title2" class="string">data2</td>
<td data-title="title3" class="date">data3</td>
</tr>
<tr>
<td data-title="title1" class="numeric">data4</td>
<td data-title="title2" class="string">data5</td>
<td data-title="title3" class="date">data6</td>
</tr>
</table>
</body>


I'm a novice with XSLT. I am looking for an overview of all relevant XML nodes that are "produced" when we save a table in Calc, so I can write a proper XSLT filter. The one that comes with LO Calc doesn't add the column names (entered by the user of the spreadsheet) as data attributes, besides it doesn't output a clean HTML code. I want this because I want to have a responsive table in my web site. There is a nice technique for making responsive tables that I want to use.

So, I ask if someone knows where I can find all the XML nodes (an schematic view) so I can have an idea of what to process through. Examples of these nodes are: office:table, office-table-row, etc. I know they are visible if I open content.xml of any Calc file (with content), but I am looking for a "cheatsheet" or a diagram or a map of the ODF spec exclusively for spreadsheet tables, if available.

Or if you know of an XSLT filter that produces clean no-styling HTML, please show me where is it, then I can modify it to add the data attributes needed.

(I hope I'm clear enough to make myself understood. If not, please bear with me and point me with questions.)

edit retag close merge delete

Not a cheatsheet, but you might want to save to FODS (Flat ODS) instead of ODS, to see the nodes easier (it's a single plain XML file, instead of zipped directory of files).

Also: you might want to consult existing XSLT filters that are bundled with LO. And look at this.

( 2017-12-08 07:07:32 +0200 )edit

How did you create a file that resulted in office-table-row? When I saved as .ods format, the result was table:table-row, as described in the ODF specification at http://docs.oasis-open.org/office/v1.....

( 2017-12-08 13:04:20 +0200 )edit

@"Jim K", I believe it's a typo on me, jajaja. Sorry for the confussion.

( 2017-12-08 23:40:58 +0200 )edit

@"Mike Kaganski", yes, it's easier to see them in FODS format… However, I would love to see some kind of visual map or diagram, if available. And about the bundled XSLT filters, they are supercomplex to be debugged by me (I'm a noob in XML/XSLT).

I believe the info that I need is in here: OASIS OpenDocument Essentials: Spreadsheets. I found this link following the answer that you pointed me out. I'll check the book and report back later. Thxs!

( 2017-12-09 00:13:16 +0200 )edit

Sort by » oldest newest most voted

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I found a decent solution.

I used the Pretty XML Tree Viewer (https://skew.org/xml/stylesheets/tree...) to outline the nodes (elements and attributes) in the ODF LO Calc file (previously I extracted the content.xml file, which is the one I used to do the transformation on the command-line, with saxonb-xslt programme in Ubuntu.

Another way that I found is to use the xmlstarlet command-line utility (it will show the unique elements of the file):

\$ xmlstarlet el -u archivo.xml

more