If you need to convert pilot-qof data into other formats, take a look at the example stylesheets installed with datafreedom-qsfxsl. You are welcome to contribute new or amended stylesheets - just post them on the QOF-devel mailing list or use the Wiki. A few simple bash scripts are also included to show how to reference the installed XSL stylesheets.
These stylesheets convert all data in the QSF XML file. Use the query support within pilot-qof to filter out unwanted records before conversion.
Referencing datafreedom XSL stylesheets. The examples in this manual reference datafreedom XSL stylesheets by a
unique resource identifier (URI) as opposed to a location (URL) on the local
filesystem or the internet. This identifier serves to ensure that datafreedom
XSL is distinguishable from other XSL files with the same name on the system
and, more importantly, to provide a more memorable and system-independent
identifier. i.e. the URI will work on any system, no matter how the package
maintainer configures the installation directories. To use these URI's (which
in the case of pilot-qof refer to XSL at http://www.data-freedom.org/xsl/)
you need to install not just xsltproc
but
also xml-core
or "recursion errors" will occur. Both
xsltproc
and xml-core
are recommended
by datafreedom-qsfxsl and should be installed by anyone wanting to use the XSL
examples in this manual.
It could be considered rude to require network access for XSL conversions
so although the examples use the data-freedom.org site as an identifier, the
examples also specify the xsltproc
option --nonet
which prevents xsltproc
from attempting to
get the XSL from the internet. Currently, the stylesheets are not
actually available online because the data-freedom.org string
is used as an identifier, not a location, although it can be used as
both.
Whilst some stylesheet content can be converted back into XML (and
thence into QSF XML), this is not always possible. If two way conversions are
important to you, please look at the datafreedom-perl
package and ask on the QOF-devel mailing list.
http://lists.sourceforge.net/lists/listinfo/qof-devel
Depending on your package manager, catalog.xml
, the
XSL stylesheets and scripts should be installed
in /usr/share/xml/datafreedom/xsl/
, or on
Fink /sw/share/xml/datafreedom/xsl/
.
xsltproc
is not particularly graceful in handling
output errors involving "chunking". Take note of the examples for
each stylesheet. Where an example only specifies a
directory, the directory must exist before running
xsltproc
and multiple files will be created in that
directory, overwriting files with the same name in that directory.
i.e. these stylesheets chunk the output.
Where an example specifies a file all results
from xsltproc
will be written to the one file. The file
does not have to exist and will be overwritten if it does exist (unless the
stylesheet notes state otherwise).
These stylesheets do not chunk the output.
If the file is not in the current directory, the specified directory must exist.
XSL stylesheets included with pilot-qof. When XML_CATALOG_FILES
is exported correctly:
export XML_CATALOG_FILES="/usr/share/xml/datafreedom/xsl/catalog.xml"
stylesheets can be referenced by the
www.data-freedom.org/xsl/
URI in combination
with the --nonet
option to xsltproc
.
For clarity, examples only include the filenames of input and output
files, not the full path. Where specific data filenames are required for certain
external programs (like calcurse
and dlume
),
these are given in the example. Ensure the full paths are specified wherever necessary.
Current stylesheets are works in progress, but include:
pilot-qof-address-vcard1.xsl
This stylesheet converts the output from pilot-qof
-d
pilot_address
into a very
brief Vcard, suitable for upload to mobile phones. Tested with a Motorola E1/ROKR
using Bluetooth. Ensure that the file uses the .vcf extension to enable the phone to
understand the file type. This stylesheet is deceptively simple but surprisingly
practical. It allows users to create mobile phone phonebook entries from existing
Palm data - there is no point in re-entering existing data. Each VCard is written into
a separate .vcf file, named after the contact described in the pilot_address records.
Spaces are replaced with underscores. Specify the '-o dir/' option
to xsltproc
to output all vcards into a directory.
Example 2.1. Chunked, brief, vcard output
mkdir tmp/ pilot-qof -x address.xml -c Travel | \ xsltproc --nonet -o tmp/ http://www.data-freedom.org/xsl/pilot-qof-address-vcard1.xsl -
pilot-qof-address-vcard2.xsl
This stylesheet converts the output from pilot-qof
-d
pilot_address
into a more
expansive Vcard, suitable for import into various address book applications.
This stylesheet is deceptively simple but surprisingly practical. It allows users
to create address book entries from existing Palm data - there is no point in
re-entering existing data. Each VCard is written into a separate .vcf file, named
after the contact described in the pilot_address records. Spaces are replaced with
underscores. Specify the '-o dir/' option to xsltproc
to
output all vcards into a directory.
Example 2.2. Chunked, expanded, vcard output
mkdir tmp/ pilot-qof -x address.xml -c Travel | \ xsltproc --nonet -o tmp/ http://www.data-freedom.org/xsl/pilot-qof-address-vcard2.xsl -
pilot-qof-address-dlume.xsl
Dlume is a small Gtk addressbook - this stylesheet converts the output
from pilot-qof
-d
pilot_address
into a dlume
XML
file that can replace or be appended to the dlume data file, typically
called ~/.dlume/dlume-data.xml
.
Currently, pilot-qof is unable to determine the type of data contained in the various Phone type entries in the Palm Address database and this can lead to email addresses showing up in dlume as mobile phone numbers or home phone numbers showing up as work numbers.
Example 2.3. Unchunked, single file, dlume output
This example overwrites the existing dlume data file with the new content.
pilot-qof -x address.xml -c Personal | \ xsltproc --nonet -o ~/.dlume/dlume-data.xml http://www.data-freedom.org/xsl/pilot-qof-address-dlume.xsl -
Example 2.4. Unchunked dlume output appended to existing content
To append data to the existing file, use the input
parameter
and specify the same dlume data file (add your full path) as output:
pilot-qof -x address.xml -c Personal | \ xsltproc --nonet --stringparam input ~/.dlume/dlume-data.xml \ -o ~/.dlume/dlume-data.xml http://www.data-freedom.org/xsl/pilot-qof-address-dlume.xsl -
pilot-qof-icalendar.xsl
This stylesheet converts the output from pilot-qof
-d
pilot_datebook
into an iCalendar file, such as used by dates
- usually
available at ~/.evolution/calendar/local/system
. Specify
a .vcs
suffix to import into other calendar applications
like gpe-calendar
.
Currently, this stylesheet does not append to an existing calendar.
Example 2.5. Unchunked, single file, iCalendar output
pilot-qof -x datebook.xml -c Personal | \ xsltproc --nonet -o personal.ics http://www.data-freedom.org/xsl/pilot-qof-icalendar.xsl -
pilot-qof-invoice-xhtml.xsl
This stylesheet is a prototype - it is intended to provide a method to convert
QSF output using the --invoice-city
or
--invoice-vendor
options into valid HTML. It includes CSS hooks
to customise the output and will accept user-specified parameters to indicate the
mileage rate or hourly rate for the invoice calculations. Each invoice is written into
a separate .html file, named after the contact described in the pilot_address records.
Spaces are replaced with underscores. Specify the '-o dir/' option to xsltproc to
output all invoices into a directory.
Example 2.6. Chunked, HTML invoice output
mkdir tmp/ pilot-qof -x alldata.xml -c Business -t 2006-07-20 | \ xsltproc --nonet -o tmp/ http://www.data-freedom.org/xsl/pilot-qof-invoice-xhtml.xsl -
pilot-qof-calcurse-apts.xsl
This stylesheet converts the output from pilot-qof
-d
pilot_datebook
into a calcurse
apts file.
Typically ~/.calcurse/apts
Example 2.7. Non-chunked calcurse appointment file
Replacing the existing file:
pilot-qof -x datebook.xml -c Business -t 2006 | \ xsltproc --nonet -o ~/.calcurse/apts http://www.data-freedom.org/xsl/pilot-qof-calcurse-apts.xsl -
Or, to append to the existing calcurse file:
pilot-qof -x datebook.xml -c Business -t 2006 | \ xsltproc --nonet http://www.data-freedom.org/xsl/pilot-qof-calcurse-apts.xsl - >> ~/.calcurse/apts
pilot-qof-calcurse-todo.xsl
Convert the output from pilot-qof
-d
pilot_todo
into a calcurse
todo list (description and date due).
Example 2.8. Non-chunked calcurse todo file
pilot-qof -x todo.xml -c Personal -t 2006 | \ xsltproc --nonet -o ~/.calcurse/todo \ http://www.data-freedom.org/xsl/pilot-qof-calcurse-todo.xsl -
Or, to append to the existing calcurse file:
pilot-qof -x todo.xml -c Personal -t 2006 | \ xsltproc --nonet http://www.data-freedom.org/xsl/pilot-qof-calcurse-todo.xsl - >> ~/.calcurse/todo
pilot-qof-todo-vtodo.xsl
Convert the output from pilof-qof
-d
pilot_todo
into a vToDo card. VToDo is similar to vCard and vCalendar.
Example 2.9. Non-chunked vToDo output
pilot-qof -x todo.xml -c Business -t 2006 | \ xsltproc --nonet -o vtodo-2006 \ http://www.data-freedom.org/xsl/pilot-qof-todo-vtodo.xsl -
pilot-qof-gpe-expenses.xsl
Convert pilot-qof
expense data to
GPE expense data. This allows QSF XML written by
pilot-qof
-d
pilot_expenses
to be loaded by
gpe-expenses
for further conversion.
Example 2.10. Palm Expenses XML to GPE Expenses XML
First, convert the Palm objects to GPE objects:
pilot-qof -t 2006 -d pilot_expenses -x expenses.xml | \ xsltproc --nonet -o gpe-expenses.xml \ http://www.data-freedom.org/xsl/pilot-qof-gpe-expenses.xsl -
Due to the size of the libxml2
package, many
embedded systems do not provide the QSF XML backend for QOF so the
gpe-expenses
package on these embedded systems only uses
SQLite via the QOF SQLite backend. To handle data from pilot-qof, you will
need to install gpe-expenses on the desktop where the QSF XML backend is
available. Data can then be read from the XML and written out as a SQLite
database which, in turn, can be copied to the embedded device.
Now convert the GPE XML into GPE SQLite:
gpe-expenses -i gpe-expenses.xml -w sqlite:gpe-expenses.sqlite
Alternatively, install libqof-backend-sqlite0
on the desktop machine, write the pilot-qof data
to sqlite and export the data using SQL queries, ready for direct import. The
sqlite file cannot be copied directly as the sqlite table names differ between the
two applications. TODO: script this method.
gpe-expenses-pilot-qof.xsl
Convert GPE expense data to
pilot-qof expense data. This allows QSF XML
written by gpe_expenses
to be loaded by
pilot-qof
.
Example 2.11. GPE Expenses XML to Palm Expenses XML
First, convert the GPE SQLite data to QSF XML:
gpe-expenses -i sqlite:expenses -w file:gpe-expenses.xml
Due to the size of the libxml2
package, many
embedded systems do not provide the QSF XML backend for QOF so the
gpe-expenses
package on these embedded systems only uses
SQLite via the QOF SQLite backend. To handle XML data, you will
need to install gpe-expenses on the desktop where the QSF XML backend is
available. SQLite data can then be copied from the embedded device, written
out as XML and converted.
Convert GPE objects into Palm objects:
xsltproc --nonet -o pilot-expenses.xml \ http://www.data-freedom.org/xsl/gpe-expenses-pilot-qof \ gpe-expenses.xml
You are free to copy and modify these stylesheets to your own requirements, including translations and customised formats. Depending on your package manager, this is often best done by copying the installed file to a local directory before modifying it. pilot-qof does not reference these stylesheets directly. If your modifications could be useful to others, please contribute them to pilot-qof via the QOF-devel mailing list or pilot-qof Wiki.