Plan-B for OpenOffice.org & LibreOffice, learning office productivity software with videos
Tech Support for OpenOffice.org & LibreOffice
Windows:
Unix/Linux:
Mac OS X:

Help Sections:
General
Writer
Impress
Math
Draw
Calc
Base
Basic

Working With OpenOffice.org XML Filters

About XML Filters

OpenOffice.org stores documents in XML format. You can create customized filters that convert the native OpenDocument XML file format used by OpenOffice.org into another format. These filters can be integrated into OpenOffice.org seamlessly so that you can save or load these formats transparently.

To create an XML filter, you must have a good understanding of XML and XSLT concepts. These concepts are beyond the scope of this help.

An XML filter contains stylesheets that are written in the XSLT language. The stylesheets define the transformation from the OpenDocument file format to another XML format through export and import filters. There are three types of XML filters:

  • Import Filters load external XML files and transform the format of the files into the OpenDocument XML file format. After you install an import filter, the name of the filter is added to the list of file types in the File Open dialog.

  • Export Filters transform OpenDocument XML files and save the files to a different XML format. After you install an export filter, the name of the filter is added to the list of file types in the Export dialog.

  • Import/Export Filters load and save OpenDocument XML files into a different XML format. After you install these filters, the names of the filters are added to the list of file types in the File Open dialog and the File Save As dialog.

Creating an XML Filter for OpenOffice.org

When you create an XML filter for OpenOffice.org, you need to design an XSLT stylesheet that can convert to and from the OpenDocument XML file format.

For more information about the OpenDocument XML format, go to http://xml.openoffice.org/.

If you want, you can include a template with your filter to apply OpenOffice.org styles to an XML document that you import.

You can also include the Document Type Definition (DTD) for the for the external XML format so you can validate the XML format, for example, when you test the filter.

To create an XML filter

  1. Create an XSLT transformation stylesheet that maps the elements of the external XML format to the elements of the OpenDocument XML file format and back again.

  2. Create a template that assigns OpenOffice.org styles to elements in the external XML format when you import a file in this format into OpenOffice.org.

  3. In OpenOffice.org Writer, create a text document, and choose Tools - XML Filter Settings.

  4. Click New.

  5. In the XML Filter dialog, click the General tab, and define the properties of the filter.

  • In the Filter Name box, enter a name for the XML filter.

    This name is displayed in the XML Filter Settings dialog.

  • In the Application box, select the OpenOffice.org application that the filter is for.

  • In the Name of File Type box, enter the file type that the filter is for.

    This name is displayed in the list of file types in the Open, Export, and Save As dialogs.

  • In the File extension box, enter the extension for the exported file.

    To differentiate the file from other XML files, enter an extension other than *.xml.

  1. On the Transformation tab page, define the transformation properties for the filter.

  • (Optional) In the DocType box, enter the document type identifier for the external file format.

    This identifier is used to detect the file type on import.

  • (Optional) In the DTD box, enter the path and file name of the DTD for the external file format.

    This DTD is used to validate the files on export.

  • In the XSLT for export box, enter the path and file name of the XSLT stylesheet that defines the transformation from OpenDocument format to the external format.

  • In the XSLT for import box, enter the path and file name to the XSLT stylesheet that defines the transformation from the external format to OpenDocument format.

  • (Optional) In the Template for import box, enter the path and name of the template that defines the OpenOffice.org styles that are used in the imported file.

    The files that are specified on the Transformation tab page are copied to the local OpenOffice.org users directory.

  1. Click OK.

To test an XML filter

You can perform basic tests on a custom XML filter in OpenOffice.org.

The document is not altered by these tests.

  1. Create or open a text document.

  2. Choose Tools - XML Filter Settings.

  3. In the list of filters, select the filter that you want to test, and click Text XSLTs.

  4. To test an Export Filter, do one of the following in the Export area of the dialog:

  • Click Browse, select the OpenOffice.org document that you want to test, and click Open.

  • To test the current document, click Current Document.

  1. To test an Import Filter, click Browse in the Import area of the dialog, select a document, and click Open.

  2. To validate the transformed file against the specified DTD, click Validate.

Distributing An XML Filter As Package

You can distribute an XML filter to multiple users using a special package format.

To save an XML filter as a package

The XML Filter Settings dialog is only available when a text document is open.

  1. In Writer, choose Tools - XML Filter Settings.

  2. Select the filter that you want to distribute and click Save As Package.

To install an XML filter from a package

The XML Filter Settings dialog is only available when a text document is opened.

  1. In Writer, choose Tools - XML Filter Settings.

  2. Click Open Package and select the package file with the filter you want to install.

To delete an installed XML filter

  1. In Writer, choose Tools - XML Filter Settings.

  2. Select the filter you want to delete and click Delete.

Index

file filters (XML)

saving,to XML

loading,XML files

importing,from XML

exporting,to XML

XSLT filters, see also XML filters

distributing XML filters

deleting,XML filters

testing XML filters

XML filters,creating/testing/distributing/deleting

This help text for MS Windows , published from the OpenOffice.org Help files Release 2.1 under the Public Documentation License 1.0.