Chapter 9. Filters in OpenOffice.org
To this point, we have been building stand-alone applications to transform external files, in XML format or just plain text, to OpenDocument format. OpenOffice.org allows you to integrate an XSLT transformation into the application as a filter.
XSLT-based filters work by associating an XML file type, which we will call the “foreign” file, XSLT transformation files for import and/or export, and an OpenOffice.org template file. XML elements in the foreign file are associated with styles in the template file. The import transformation will take the foreign file's content and insert it into the template, assigning styles as appropriate. The export transformation will read the OpenOffice.org document, and, using the style information, create a foreign file.
The remainder of this chapter will be a case study that shows how to construct and install XSLT-based filters.
The Foreign File Format
The XML that we will import is a database of amateur wrestling clubs in California (yes, this is an actual database; the phone numbers and emails have been changed.) The state is divided into several areas or associations; for example, SCVWA—the Santa Clara Valley Wrestling Association. Each association consists of a series of clubs. Example 9.1, “Sample Club Database” shows an abbreviated file. A club can have multiple email addresses, and the <info> element is optional. The only element that isn't self-explanatory is the <age-groups> element. Its type attribute ...
Get OASIS OpenDocument Essentials: Using OASIS OpenDocument XML now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.