[xsl] Omnimark vs. XSL (Saxon) Challenge improved

Subject: [xsl] Omnimark vs. XSL (Saxon) Challenge improved
From: Michael Müller-Hillebrand <info@xxxxxxxxxxxxx>
Date: Wed, 17 Mar 2004 17:13:53 +0100
Thanks to all your tips and suggestions!

I have a table like this with width attributes scattered all over the table in the td elements:

| a         | b         |
|           +-----+-----+
|           | c   | d   |
+-----------+-----+     |
| e               |     |
+-----+-----+-----+     |
| f   | g   | h   |     |

I need the column widths collected in the table element: 
<table width="w1 w2 w3 w4">

The problem is to find that the width attribute of cell "c" is not valid for column 1 (although it is cell #1 in row #2) but column 3 instead.

My current solution is working but still slow (using my computer and Instant Saxon 6.5.3 on Windows XP):

64 rows: 2 secs
128 rows: 7.5 secs
192 rows: 19 secs
256 rows: 30 secs

The basic steps of the solution are:

1a) Create a list of <cell col="x" row="y" /> elements, one for every un-spanned cell.

1b) Create a simplified table which removes all colspans but keeps rowspans.

2) Parse the simplified table and set attributes in the list of cells to show which cells are already used. This allows me to check, to which column cell "c" belongs, because the first to entries in row #2 are already used at this time.

3) For each column in the list of cell elements find the first with a width attribute.

4) Process the original table with the new width attribute and drop the individual td widths.

I added additional comments to the stylesheet and together with my explanation the case hopefully a little bit clearer than yesterday. This following page contains links to data files and shows input, stylesheet and output:


Now it is the algorithm, which may be unnecessarily costly? I hope so... all suggestions are appreciated!

- Michael
Dipl.-Ing. Michael Müller-Hillebrand
"Mehr Effizienz für Wissensarbeiter" --> http://cap-studio.de

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread