I'd like to apply an XSL transformation to my DocBook (CALS-style) tables
which outputs each cell of each table, together with the label of its
row(s) and column(s). That is, for a table that looks like
| Col1Label | Col2Label |
---------------------------------------------|
Row1Label | Cell1 | Cell2 |
---------------------------------------------|
Row2Label | Cell3 |
Row3Label | |
---------------------------------------------|
the transform would output something like
...
<Entry>
Cell1
<RowLabels>
<RowLabel text="Row1Label"/>
</RowLabels>
<ColLabels>
<ColLabel text="Col1Label"/>
</ColLabels>
</Entry>
<Entry>
Cell2
<RowLabels>
<RowLabel text="Row1Label"/>
</RowLabels>
<ColLabels>
<ColLabel text="Col2Label"/>
</ColLabels>
</Entry>
<Entry>
Cell3
<RowLabels>
<RowLabel text="Row2Label"/>
<RowLabel text="Row3Label"/>
</RowLabels>
<ColLabels>
<ColLabel text="Col1Label"/>
<ColLabel text="Col2Label"/>
</ColLabels>
</Entry>
...
Before I go off and try to do something like that, is there any existing
transform that does that? I'd prefer XSLT or Python, but I'd accept other
solutions.
BTW, the application is that we're writing grammars in DocBook, and if a
table represents a paradigm, then its entries--the forms of the
paradigm--are test cases for our parser. I can extract the test cases
easily, but it would be nice to also extract an indication of the expected
parse, which is partly indicated by the row and column labels. I have
thought of going in the opposite direction--that is, creating an XML
structure for paradigms, then automatically converting that into a DocBook
. But there are other problems with that.
Mike Maxwell