#!/bin/bash
set -e
if [ ! $1 ]
then
	echo "Usage: $0 <output-dir> <xml-file>"
	echo
	echo "Convert a pilot-qof address XML file into simple vcards"
	echo "Two arguments needed, output directory and the XML file"
	exit
fi
if [ ! -d $1 ]
then
	echo "First argument should be a directory to write the vcards"
	exit
fi
if [ ! -f $2 ]
then
	echo "Second argument should be an XML file."
	exit
fi
XML_CATALOG_FILES="/usr/share/xml/pilot-qof/xsl/catalog.xml" \
 xsltproc --nonet -o $1 http://www.data-freedom.org/xsl/pilot-qof-address-vcard1.xsl $2

