Re: [xsl] stylesheet templates for OpenOffice spreadsheets

Subject: Re: [xsl] stylesheet templates for OpenOffice spreadsheets
From: Emmanouil Batsis <Emmanouil.Batsis@xxxxxxxxxxx>
Date: Thu, 01 Sep 2005 18:56:31 +0300
Last time i had a similar problem i just came up with a "normalization filter" used before the transformation. In my case it was a simple SAX filter so it had a minor effect in performance and the benefit of low XSLT complexity. You can of course start creating variables by adding positions and number-columns-repeated and use that, but i preffer simple solutions ;-)



Stan wrote:

I've been taking a look at the xml format that the latest OpenOffice
spreadsheets produce and was trying to come up with a generalized
template that would extract the value from the nth row and mth column.

In general, OpenOffice expresses a spreadsheet grid like this (removing
the cruft for illustrative purposes):

    <!-- and so on -->

A template for this is fairly easy to reproduce because the mth column
of the nth row is just "table/row[n]/col[m]". The problem comes in for
spreadsheet grids that are sparsely or reduntantly filled. In this case,
presumably to save space, the format looks something like this (assuming
the first two columns of the first row are empty):

    <row><col number-columns-repeated="2"/><col>3</col></row>

This makes things much more difficult since now we have to account for
the number-columns-repeated attribute. A generalized approach will now
have to add all the number-columns-repeated values to find the mth column.

I thought that before I started working on producing this, I'd see if
anyone has tackled this before or perhaps there is some magic xpath
statement that eludes me.


Current Thread