Some of the ideas here have been rolled into the server side
TWiki:Plugins/OpenOffice2TWikiAddOn
including the XSLT stylesheet attached below. The stylesheets in the add-on package are probably more complete and can be used from within
OpenOffice.org as described below, although I always find it produces superfluous attributes in element tags.
--
WadeTurland - 06 Aug 2005
I started hacking away at an XSLT to generate
WikiSyntax from an
OpenOffice.org text document. It mostly works but I am having difficulty with extra newlines creeping into the
WikiSyntax output where I don't expect them. Any advice on how to fix this up would be helpful.
I intend to integrate this into my local TWiki installation as a feature to insert the contents of
OpenOffice.org attachments into the topic text.
The problems with the current document when used with
xsltproc are:
- Many extra newlines in the output.
- Each text:p template outputs extra newlines. This messes up table output:
|
*
Row A*|
*
Row B*|
*
Row C*|
*
Row D*|
*
Row E*|
It should look like this:
|*Row A*|*Row B*|*Row C*|*Row D*|*Row E*|
Any advice that can be offered would be appreciated.
--
BradDixon - 13 Oct 2003
- Import Open Office document: Sample content.xml file now has processing instruction to apply XSL automatically. It also uses XslWiki library to create a edit frame. I fixed some of the formatting, will correct more next week.
--
JohnCoe - 28 Mar 2004
John, this sounds really interesting. Can you tell me more?
--
CrawfordCurrie - 28 Mar 2004
- I tried to edit this drawing to reflect the processing path but the changes did not save!
The difference is that the
XML file has a stylesheet attached. The file stylesheet uses it's document
function to get a TWiki edit page. The XSL formatting is done inside the textarea so it can be saved in TWiki.
If you have not logged in you will get 'Access Denied' The login can be forced with a frame.
There is IE dependant code in the file but it is not being used for this, so it should not limit the browser.
Most of the format problem that
BradDixon encountered can be corrected with correct use of xsl:text
--
JohnCoe - 28 Mar 2004
I just uploaded a new version of my
OOo_TWiki.xslt XSLT transformer. It is now converting
OpenOffice.org text documents fairly well. Supported features include:
- basic formatting
- tables
- ordered and unordered lists... but only two levels deep.
- headings
- "span" formatting like this.
I am not supporting any advanced syntax features of the upcoming releases. Feel free to extend my work. I do want to keep this a basic converter. I'm not trying to do any fancy frames.
JohnCoe and I agreed to split our efforts. You can take this XSLT document and install it in
OpenOffice.org and do a File->Export->Wiki!
How to install in
OpenOffice:
- Tools -> XML Filter Settings
- New...
- Filter name - Twiki
- Application - OpenOffice Writer
- Name of file type - Twiki
- File extension - txt (or similar)
- Go to the "Transformation" tab
- Set "XSLT for export" to where you saved the OOo_TWiki.xslt file
- OK button
- You should now be able to use File -> Export in OO Writer to export the 'Twiki' type, and use the resulting .txt file contents in Twiki.
--
ChrisHorsley - 13 Apr 2004
Example:
This is a test.
1 Numbered *list* with _italics_.
1 Another numbered
* Bulleted listing
* inset bullet.
* Outset bullet.
End it all.
--
BradDixon - 30 Mar 2004
This demo locks a destination TWiki page for write, so currently only one user can try the demo at any given time.
*
Open Office Import demo: If you use this frame, login will work correctly. The
XML file can be an attachment or a file on a client machine.
It it is run from the client, the URLs must be adjusted.
This interface has a minor Mozilla problem with mimetype settings in xml files, but should be correctable.
--
JohnCoe - 31 Mar 2004
Take a look at
MsOfficeAttachmentsAsHTMLPlugin - I'm sure it could be used as a starting place to make this part of the standard framework.
--
MartinCleaver - 15 Apr 2004
Using this XSLT and using the macro shown in
http://www.oooforum.org/forum/viewtopic.php?p=3423
(by dfrench from Wellington, New Zealand) I'm converting swx files from one directory to twiki formated txt files.
In case the links gets broken, the code is:
sub ToTiki
rem takes all .sxw files from chosen directory and writes .txt files with twiki format
rem to another chosen directory
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
dim sInDir as string
dim sOutDir as string
dim sFile as string
dim sUrl as string
dim spdf as string
dim doct as object
Dim args(0) as new com.sun.star.beans.PropertyValue
dim args1(2) as new com.sun.star.beans.PropertyValue
dim mNoArgs() ' supplies empty arg list
' get the input and output directories for the document source and pdf output
sInDir = InputBox("Input Directory","Macro Dialog","file:///home/rpacheco/twiki/ORIG/")
sOutDir = InputBox("Output Directory","Macro Dialog","file:///home/rpacheco/twiki/FINAL")
' DIR basic runtime sets directory and returns first filename
sFile = Dir(sInDir+"*.sxw") ' can be any valid selection for file namesnnnn
' set up interfaces required
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
oDesktop = createUnoService("com.sun.star.frame.Desktop")
' property for silent ie no visible document operation
args(0).Name = "ReadOnly"
args(0).Value = True
While sFile <> "" ' loop while there are files to process in input directory
sUrl = sIndir+sfile
' load doc by name
doct=oDesktop.loadComponentFromURL(sURL,"_blank",0,Args())
rem ----------------------------------------------------------------------
rem get access to the document so can send commands to it
document = doct.CurrentController.Frame
' output file name replace the .xxx with .txt
spdf =sOutDir+ left(sfile,len(sfile)-4)+".txt"
rem ----------------------------------------------------------------------
'set properties
args1(0).Name = "URL"
args1(0).Value = spdf
args1(1).Name = "FilterName"
args1(1).Value = "Twiki"
' ask document controller to create the pdf
dispatcher.executeDispatch(document, ".uno:ExportDirectToPDF", "", 0, args1())
' unload the document object
doct.dispose()
' get next filename null when none left
sfile = dir
wend
end sub
--
RicardoPacheco - 18 Oct 2004