|
The new table2document.xsl gets some tables out excel's XML output.
Improvements welcome! Extraction of simple tables from Excel.
Unzip and put into the appropriate places. The Stylesheet creates one section and table per Excel tabsheet. The title of the page is taken from the Excel properties, the subtitles are the sheet titles. In Excel use File->Save as... and select File type XML. The file must be named *-table.xml. The first line of a sheet is taken as table header. Empty cells are not displayed. Excel formatting is ignored. If the first cell of a row is "figure" this will create a figure above the table with the second cell as filename (appended to "image/") and the fourth (4th) cell as figure caption (may be more than one figure). Images need to be copied to Forrest's images-folder. The stylesheet is suboptimal: it makes (too much) use of XSL position(); I did not know better, so I used XSL modes for table header and figure; all empty cells are removed: this may move cells to the left, so in Excel you need to insert a space into empty cells. I would be very glad if someone could improve on the stylesheet, so that I have a cance to learn :-) Johannes forgot the images, sorry.
This needs to be made into an output plugin, see http://svn.apache.org/viewcvs.cgi/forrest/trunk/docs-author/content/xdocs/howto/howto-buildPlugin.xml?view=markup
for instructions how to do this I made it into an input plugin (A small present to your son, Ross :-)
I give this plugin to the forrest community under the Apache license (or whatever may be required). Note: I don't know about trademarks. Excel may be protected so please choose an appropriate name! Committed to SVN with a few changes:
- changed name to org.apache.forrest.excel in case this plugin is developed to do more than provide tables - removed empty documentation files - fixed XML so it validated - fixed samples so that site will build |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
>
and then do the match like this
<xsl:template match="ss:Workbook">
^^^ use prefix!
<document>
<header>
<title>Excel Workbook
(<xsl:value-of select="o:DocumentProperties/o:LastAuthor"/>)</title>
^^^ ^^^
</header>
<body>
<xsl:apply-templates/>
</body>
</document>
</xsl:template>