This is not at all simple. Basically, you are asking how to render an HTML table visually, by positioning each cell on a (equi-spaced) x-y grid of rows and columns.
This is complex, because the position of each cell depends not only on the width (colspan) of the preceding cells in the same row, but also on the position of cells in preceding rows that span more than one row. This position is not known before the preceding cells themselves have been processed - so this is a giant render-as-you-go cascading operation.
Due to this complexity, I suggest solving the basic problem in isolation first, before introducing additional constraints (e.g. separate header rows or numbers starting from 0).
For testing, I have used the following table1 as the input:
Column 1 |
Column 2 |
Column 3 |
A |
B |
C |
D |
E |
F |
G |
H |
Applying the folowing stylesheet:
XSLT 1.0
1
1
|
produces the following result:
Column 1 |
Column 2 |
Column 3 |
A |
B |
C |
D |
E |
F |
G |
H |
As you can see, the x-y positioning of each cell corresponds to the visual rendering of the original table in a browser:

--
1. From http://en.wikipedia.org/wiki/Help:Table
For XSLT 2.0:
Change the stylesheet declaration to:
Change line #66 to: