Issue Details (XML | Word | Printable)

Key: FOR-373
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Ross Gardler
Reporter: Johannes Schaefer
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Forrest

Excel to Forrest stylesheets

Created: 16/Nov/04 04:11 PM   Updated: 29/Jan/05 04:02 PM
Return to search
Component/s: Plugins (general issues)
Affects Version/s: 0.7
Fix Version/s: 0.7

Time Tracking:
Not Specified

File Attachments:
  Size
Zip Archive org.apache.forrest.plugin.excel-table.zip 2004-12-20 07:55 PM Johannes Schaefer 506 kB
JPEG File shop.jpg 2004-11-19 05:28 PM Johannes Schaefer 24 kB
File sitemap.xmap 2004-11-16 04:12 PM Johannes Schaefer 0.4 kB
XML File table2document.xsl 2004-11-16 05:33 PM Johannes Schaefer 1 kB
XML File table2document.xsl 2004-11-16 04:57 PM Johannes Schaefer 0.7 kB
XML File table2document.xsl 2004-11-16 04:12 PM Johannes Schaefer 0.6 kB
Zip Archive table2forrest.zip 2004-11-19 05:10 PM Johannes Schaefer 5 kB
PNG File test.png 2004-11-19 05:28 PM Johannes Schaefer 12 kB
Microsoft Excel test2-table.xls 2004-11-16 04:13 PM Johannes Schaefer 14 kB
XML File test2-table.xml 2004-11-16 04:12 PM Johannes Schaefer 4 kB
Environment:


 Description  « Hide
I'm trying to get some tables out of Excel into
Forrest ... should be easy since Excel writes
legible XML [1].

I put together a sitemap.xmap [2] for *-table.xml.

I started writing my table2document.xsl [3] but
it didn't match anything, i.e. the version below
doesn't match anything. Matching "/*/*" gives me
the 2nd level elements: DocumentProperties, ...,
and Worksheets.

After removing all references to namespaces (xmlns)
and replacing ":" with "_" it works.

Can any XSL guru help me to get the XSLT working
without modifying the Excel-output first?

Thanks,
Johannes

See Attachments
[1] Excel XML output: test2-table.xml
[2] documents/sitemap.xmap
[3] table2document.xsl


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Johannes Schaefer made changes - 16/Nov/04 04:12 PM
Field Original Value New Value
Attachment sitemap.xmap [ 10320 ]
Johannes Schaefer made changes - 16/Nov/04 04:12 PM
Attachment table2document.xsl [ 10321 ]
Johannes Schaefer made changes - 16/Nov/04 04:12 PM
Attachment test2-table.xml [ 10322 ]
Johannes Schaefer made changes - 16/Nov/04 04:13 PM
Attachment test2-table.xls [ 10323 ]
Johannes Schaefer added a comment - 16/Nov/04 04:57 PM
I need to put in:
<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>

Johannes Schaefer made changes - 16/Nov/04 04:57 PM
Attachment table2document.xsl [ 10324 ]
Johannes Schaefer added a comment - 16/Nov/04 05:33 PM
The new table2document.xsl gets some tables out excel's XML output.
Improvements welcome!

Johannes Schaefer made changes - 16/Nov/04 05:33 PM
Attachment table2document.xsl [ 10325 ]
Johannes Schaefer added a comment - 19/Nov/04 05:10 PM
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

Johannes Schaefer made changes - 19/Nov/04 05:10 PM
Attachment table2forrest.zip [ 10334 ]
Johannes Schaefer added a comment - 19/Nov/04 05:28 PM
forgot the images, sorry.

Johannes Schaefer made changes - 19/Nov/04 05:28 PM
Attachment shop.jpg [ 10335 ]
Johannes Schaefer made changes - 19/Nov/04 05:28 PM
Attachment test.png [ 10336 ]
Ross Gardler added a comment - 19/Nov/04 06:05 PM
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

Ross Gardler made changes - 19/Nov/04 06:05 PM
Fix Version/s 0.7 [ 10031 ]
Type Bug [ 1 ] New Feature [ 2 ]
Component/s Plugins (general issues) [ 10030 ]
Priority Major [ 3 ] Minor [ 4 ]
Summary Excel to Forrest: namespaces Excel to Forrest stylesheets
Component/s Core operations [ 10010 ]
Ross Gardler made changes - 02/Dec/04 01:27 AM
Assignee Ross Gardler [ rgardler ]
Johannes Schaefer added a comment - 20/Dec/04 07:55 PM
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!

Johannes Schaefer made changes - 20/Dec/04 07:55 PM
Attachment org.apache.forrest.plugin.excel-table.zip [ 10348 ]
Ross Gardler added a comment - 29/Jan/05 04:02 PM
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

Ross Gardler made changes - 29/Jan/05 04:02 PM
Resolution Fixed [ 1 ]
Status Open [ 1 ] Closed [ 6 ]