# This is an adaptation of a script i found at xmlsoft.org
#                           Jon Svendsen

ROOTCATALOG=/etc/xml/catalog
CATALOG=/etc/xml/docbook

xsldir=""
dir=/usr/share/xml/docbook/xsl-stylesheets-`echo $VERSION|cut -d . -f 1,2`
if [ -r $dir/html/docbook.xsl -a -r $dir/common/l10n.xml ]; then
   xsldir=$dir
fi

if [ "$xsldir" = "" ] ; then
    echo could not locate DocBook XSLT stylesheets
    return 1
fi
echo Found DocBook XSLT stylesheets in $xsldir
for version in current 1.39 1.40 1.41 1.42 1.43 1.44 1.45 1.46 1.47 \
               1.48 1.49 1.50 1.69 1.70 1.71 1.72
do
    xmlcatalog --noout --add "rewriteSystem" \
	"http://docbook.sourceforge.net/release/xsl/$version" \
	"file://$xsldir" $CATALOG
    xmlcatalog --noout --add "rewriteURI" \
	"http://docbook.sourceforge.net/release/xsl/$version" \
	"file://$xsldir" $CATALOG
done

xmlcatalog --noout --add "delegateSystem" \
    "http://docbook.sourceforge.net/release/xsl/" \
    "file://$CATALOG" $ROOTCATALOG
xmlcatalog --noout --add "delegateURI" \
    "http://docbook.sourceforge.net/release/xsl/" \
    "file://$CATALOG" $ROOTCATALOG

