I thought the model would be XML->HTML for the web and XML->MS Word for the print version. It turns out to be easier, much easier, to go XML->HTML->MS Word!
To look at the sample file, the HTML version of Whist.3 is here. Below is the translation to MS Word:
|(click to enlarge)|
Other than spanning rows, the hardest thing was managing whitespace. There is a whole section in my XSLT/XPath book on whitespace including a subsection "Solving Whitespace Problems" with subsections "Too Much Whitespace" and "Too Little Whitespace". I had problems with both. It was necessary:
- to have the XML->HTML transformation use stricter <xsl:output method ="xml"> rather than "=html"
- to have the HTML->MS Word transformation use <xsl:strip-space elements="*"/>
- to write a function to "normalize" all text data--that is, collapse consecutive white space into a single space, but allow an initial leading and trailing space.
There may well be better ways to do this. I found myself frequently at the boundaries of my knowledge. But with a lot of Googling and reading, I've found that many others have been down this path and come up with similar solutions.
OK, enough technology. Back to bibliography!
Post a Comment