Scripts. XSL conversions can require a lot of commands and options, most of which do not change between runs. pilot-qof includes sample scripts that demonstrate how to ease the process.
Example 4.1. Using stylesheets in scripts of your own
A typical command from one of these scripts is:
XML_CATALOG_FILES="/usr/share/xml/datafreedom/xsl/catalog.xml" \ xsltproc --nonet http://www.data-freedom.org/xsl/pilot-qof-calcurse-todo.xsl $1
$1 indicates the first argument passed to the script (in this
case an XML file).
XML_CATALOG_FILES is an environment
variable, set just for this script. Where stylesheets in this manual can
use other options, these are documented in a shortened form that omits the
environment variable and the URL of the stylesheet.
Sample bash scripts are neither installed into system-wide locations nor available within the default system path. You are advised to copy the scripts into user-specific locations to make it easier to adjust the script behaviour.
A sample bash script that demonstrates how an XSL stylesheet can
be used with less typing. It uses
pilot-qof-address-vcard1.xsl as an example. Other
scripts are also included:
Automate use of the pilot-qof-calcurse-apts.xsl stylesheet.
Automate use of the pilot-qof-calcurse-todo.xsl stylesheet.
dfexport-all is intended to export
pilot-qof data to various supported applications.
Unlike the datafreedom stylesheets which can work with just the QSF XML,
this example script uses the
pilot-qof utility to update
and query the XML. The script will fail if
is not installed.
dfexport-all should be run in the same
directory as the
pilot-qof data. If the
offline.xml is not in the correct directory,
dfexport-all will seek to connect to the Palm to create
the file from a pilot-qof HotSync.
For this reason, dfexport-all is still an example
script (installed in
Example 4.2. Using dfexport-all and zenity-invoice with gnucash to create invoices
Creating invoices in gnucash is still a labour intensive task but by using
datafreedom-perl together with
dates, it is
possible to have all the necessary information on the same screen.
dfexport-all can export calendar data to
which in turn supports a drop down calendar from the clock in the panel dock. This
highlights the days that have events and includes the description of the event, which
helps in creating the invoice window data in
zenity-invoice is another sample script that displays
the invoice using data calculated from
pilot-qof, allowing easier
data entry into the gnucash invoice entries. In the figure,
has been assigned a sample spreadsheet-like icon by adding a customised applet to the
zenity-invoice uses perl and is part of the
datafreedom-perl package. Generating an invoice with XSL is problematic
unless your invoice needs are very simple. Eventually, it is hoped that gnucash will be able
to import invoice data as XML or other text format, at which point
will provide a script to automate the process within the
Any plain text, XML or HTML format can be generated, including possibly LDAP. If you have a request for an XSL stylesheet or if you have a stylesheet you would like to make available to others, mention it on the QOF-devel mailing list. http://lists.sourceforge.net/lists/listinfo/qof-devel
Although it is fine to pipe pilot-qof output to other processes like xsltproc, (note the terminal dash - to denote that xsltproc should expect the XML content on stdin) :
Example 4.3. Redirection from a QSF XML file.
$ pilot-qof -x whole_year.xml --invoice-city -t 2006-03-01 | \ xsltproc --nonet http://www.data-freedom.org/xsl/pilot-qof-invoice-xhtml.xsl -
Just remember that it might not be so wise to do this:
Example 4.4. Redirection from a HotSync - use with caution.
$ pilot-qof -a --invoice-city -t 2006-03-01 | \ xsltproc --nonet http://www.data-freedom.org/xsl/pilot-qof-invoice-xhtml.xsl -
Why? Because using
-a means that your Palm data is
not being backed up in this process (because the XML sent to xsltproc by the
pipe is not saved and cannot be recreated from the HTML). Now, of course, you
can sync your Palm twice but reading from the backup file is a lot faster.
"If the Palm data has changed, use
-a to backup to file.
If the Palm data has not changed, use
read the backup file."
Reporting Bugs. Please do NOT report bugs in pilot-QOF to pilot-link or GnuCash. Report bugs via the Pilot-QOF Mantis bug tracker. http://sourceforge.net/apps/mantisbt/pilot-qof/main_page.php