Forum .LRN Q&A: Response to Import/Export XML

Collapse
Posted by Eduardo Palacio on

Hi to all,


I'm sorry for my little knowledge about ETP, but it seems to be a big company's tool, so they should help you to export your ETP to XML. If not, it'll be a very hard job since you need to know all the labels in both languages to form the equivalences.


Once you have the XML you only have to know these things:


1.- This man has a XSLT for Dockbook that you can customize just modifying some variables in it. Look at:


http://wwws.sun.com/software/xml/developers/online-pub/sec04.html


2.- You need to make a few changes in OpenACS or ACS to create a form to upload this FILE.xml and run a new group of TCL's. To use the Instant-Saxon you can download it at http://users.iclway.co.uk/mhkay/saxon/index.html.


This is a line commands program (use the command "exec" in your TCL) that will make the transformations with a .xml, .xsl and a few parameters. In other words, if you use the Norman Walsh Dockbook XSLT you will be able to obtain a web. Pay attention where you put this contents, you need a URL in OpenACS to call it.


3- A simple solution for export is to keep the last version of your .xml in OpenACS because when you push in the submit of the export option, it is automatically sent.



The first file: FORM.tcl


#After: checking, write the headers…

ns_write "
<form enctype=multipart/form-data action=form-2.tcl method=post>
<center><p>
<table border=2 cellpadding=10>
<tr><td>
<center>
<br><b>XML to load:</b>
<p><input type=file size=30 name=attachment>
<p><input type=submit value="Upload">
</center>
</td>
</tr>
</table>
</p></center>
#write the footers<br>
#end file.<br>

 

The second file: FORM-2.tcl
#After: checking, write the headers…
#Keep in mind that you need to have the FILE.xml in the system file if 
you want to use the Instant-Saxon.
#Make modifications in OpenACS in order to recognize the course location.

if {[catch { exec instant-saxon $tmp_filename $tmp_filename $dir
#see saxon documentation about.
} errmsg]
&& ![regexp {caution: filename not matched} $errmsg]}{...

ns_write "See your course in <a href="$dir"> $name_course</a>"

#for the error control
#your footer.
#end file.


That's all, I hope this can help you, bye.


PD: See the apache xml proyect,
http://xml.apache.org and http://xml.apache.org/cocoon/index.html