#!/bin/bash
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
set -e
if [ ! $1 ]
then
	echo "Usage: $0 <xml-file>"
	echo
	echo "Convert a pilot-qof todo XML file into a calcurse todo list."
	echo "One argument needed - the XML file. Redirect the output to"
	echo "your calcurse file with > ~/.calcurse/todo or to append "
	echo "use >> ~/.calcurse/todo "
	exit
fi
if [ ! -f $1 ] && [ '-' != $1 ]
then
	echo "First argument should be an XML file or '-' for stdin."
	exit
fi

XML_CATALOG_FILES="/opt/holly/pilot-qof/share/xml/datafreedom/xsl/catalog.xml" \
 xsltproc --nonet http://www.data-freedom.org/xsl/pilot-qof-calcurse-todo.xsl $1

