by [email protected]
on Oracle Blogs
See other posts from Oracle Blogs
or by [email protected]
Published on Mon, 06 Dec 2010 13:52:12 +0000 Indexed on 2010/12/06 16:58 UTC
Read the original article Hit count: 404
XML is well-suited for such a translation via the companion Extensible Stylesheet Language Transformations (XSLT). Basically XSLT utilizes XSL, a template on what to read from your input XML data file and where to place it into the target document. The target document can be anything you like, i.e. XHTML, CSV, or even a OpenOffice Spreadsheet, etc. as long as it is a plain text format.
XML 2 OpenOffice.org Spreadsheet
For the XSLT to work as an OpenOffice.org Calc Import Filter:
How to add an XML Import Filter to OpenOffice Calc
- Start OpenOffice.org Calc and
select Tools > XML Filter Settings
- Fill in the details as follows:
Application: OpenOffice.org Calc (.ods)
Name of file type: Oracle Real User Experience Insight
File extension: xml
- Switch to the transformation tab and enter/select the following leaving the rest untouched
XSLT for import: ruei_report_data_import_filter.xsl
Please see at the end of this blog post for a download of the referenced file.
- Select RUEI Import filter from list and Test XSLT
Click on Browse to select
Transform file: export.php.xml
OpenOffice.org Calc will transform and load the XML file you retrieved from RUEI in a human-readable format.
- You can now select File > Open... and change the filetype to open your RUEI exports directly in OpenOffice.org Calc, just like any other a native Spreadsheet format.
Files of type: Oracle Real User Experience Insight (*.xml)
File name: export.php.xml
XML 2 XHTML
Most XML-powered browsers provides for inherent XSL Transformation capabilities, you only have to reference the XSLT Stylesheet in the head of your XML file. Then open the file in your favourite Web Browser, Firefox, Opera, Safari or Internet Explorer alike.
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- inserted line below -->
<?xml-stylesheet type="text/xsl" href="ruei_report_data_export_2_xhtml.xsl"?>
<!-- inserted line above -->
You can find a patched example export from RUEI plus the above referenced XSL-Stylesheets here:
- export.php.xml - Example report data export from RUEI
- ruei_report_data_export_2_xhtml.xsl - RUEI to XHTML XSL Transformation Stylesheet
- ruei_report_data_import_filter.xsl - OpenOffice.org XML import filter for RUEI report export data
If you would like to do things like this on the command line you can use either Xalan or xsltproc.
The basic command syntax for xsltproc is very simple:
xsltproc -o output.file stylesheet.xslt inputfile.xml
You can use this with the above two stylesheets to translate RUEI Data Exports into XHTML and/or OpenOffice.org Calc ODS-Format. Or you could write your own XSLT to transform into Comma separated Value lists.
Please let me know what you think or do with this information in the comments below.
- OpenOffice XML Filter - Create XSLT filters for import and export -
- SUN OpenOffice.org XML File Format 1.0 -
© Oracle Blogs or respective owner