Re: Detecting stylesheets and DTDs
- From: Daniel Veillard <veillard redhat com>
- To: Dan Mueth <d-mueth uchicago edu>
- Cc: Alexander Kirillov <kirillov math sunysb edu>, GDP <gnome-doc-list gnome org>, gnome-hackers gnome org
- Subject: Re: Detecting stylesheets and DTDs
- Date: Sat, 19 Jan 2002 16:54:14 -0500
[ Cc'ed to gnome-hackers since people doing releases may start having
troubles building docs too ]
On Fri, Jan 18, 2002 at 02:30:13PM -0600, Dan Mueth wrote:
>
> On 18 Jan 2002, Alexander Kirillov wrote:
>
> > Once again: we are just asking for disaster - on greater majority of
> > distro's, DTD and stylesheet are not properly registered in xml
> > catalog. Yes, of course, this is the packagers' fault - so what? Whoever
> > is to blame, the users will be the victims. You can't expect all users
> > to update their catalogs themselves. For example, I have relatively
> > recent distro (Mdk 8.1), I installed libxml2, libxslt, stylesheets, but
> > on my machine, I get this:
> >
> > [shurik localhost shurik]$ xmlcatalog /etc/xml/catalog
> > http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl
> > No entry for SYSTEM
> > http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl
> >
> > OK, I know how to fix it. But average user does not. And we can't hope
> > that an average user will go to DV's web page to read instructions, nor
> > do I think he should.
Right, if this is missing the enclosed script should do this for you.
If it can write to the /etc/xml/ directory, it will set-up /etc/xml/catalog
and /etc/xml/docbook based on the resources found on the system. Otherwise
it will just create ~/xmlcatalog and ~/dbkxmlcatalog and doing
export XMLCATALOG=$HOME/xmlcatalog
should allow to process DocBook documentations without requiring network
accesses for the DTd or stylesheets
Works for me at least:
orchis:~ -> ./rebuildCatalog
Unable to update root catalog /etc/xml/catalog
Using /u/veillard/xmlcatalog as the root catalog
export XMLCATALOG=/u/veillard/xmlcatalog
creating XML Catalog root /u/veillard/xmlcatalog
creating DocBook XML Catalog /u/veillard/dbkxmlcatalog
Found DocBook XML 4.1.2 DTD in /usr/share/xml/docbook/dtd/4.1.2
Found ISO DocBook entities in /usr/share/xml/docbook/dtd/4.1.2/ent
Found DocBook XSLT stylesheets in /u/veillard/XSLT/tests/docbook
orchis:~ -> xmlcatalog /u/veillard/xmlcatalog "ISO 8879:1986//ENTITIES Greek Letters//EN"
file:///usr/share/xml/docbook/dtd/4.1.2/ent/iso-grk1.ent
orchis:~ -> xmlcatalog /u/veillard/xmlcatalog "ISO 8879:1986//ENTITIES Added Math Symbols: Ordinary//EN"
file:///usr/share/xml/docbook/dtd/4.1.2/ent/iso-amso.ent
orchis:~ -> xmlcatalog /u/veillard/xmlcatalog "-//OASIS//DTD DocBook XML V4.1.2//EN"
file:///usr/share/xml/docbook/dtd/4.1.2/docbookx.dtd
orchis:~ -> xmlcatalog /u/veillard/xmlcatalog http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl
file:///u/veillard/XSLT/tests/docbook/html/chunk.xsl
orchis:~ ->
Daniel
--
Daniel Veillard | Red Hat Network https://rhn.redhat.com/
veillard redhat com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
#!/bin/sh
if [ ! -d /etc/xml -a -w /etc ]
then
echo Directory /etc/xml missing creating it
mkdir /etc/xml
chmod 755 /etc/xml
fi
if [ -w /etc/xml/catalog -a -w /etc/xml ]
then
ROOTCATALOG=/etc/xml/catalog
CATALOG=/etc/xml/docbook
else
echo Unable to update root catalog /etc/xml/catalog
echo Using $HOME/xmlcatalog as the root catalog
echo export XMLCATALOG=$HOME/xmlcatalog
ROOTCATALOG=$HOME/xmlcatalog
CATALOG=$HOME/dbkxmlcatalog
fi
#
# create the catalogs root and docbook specific
#
if [ ! -r $ROOTCATALOG ] ; then
echo creating XML Catalog root $ROOTCATALOG
/usr/bin/xmlcatalog --noout --create $ROOTCATALOG
fi
if [ ! -r $ROOTCATALOG ] ; then
echo Failed creating XML Catalog root $ROOTCATALOG
exit 1
fi
if [ ! -r $CATALOG ] ; then
echo creating DocBook XML Catalog $CATALOG
/usr/bin/xmlcatalog --noout --create $CATALOG
fi
if [ ! -r $CATALOG ] ; then
echo Failed creating DocBook XML Catalog $CATALOG
exit 1
fi
#
# find the prefix for DocBook DTD
#
found=`find /usr/share/xml -name docbookx.dtd`
if [ "$found" = "" ] ; then
found=`find $HOME -name docbookx.dtd`
fi
if [ "$found" = "" ] ; then
found=`find /usr/local -name docbookx.dtd`
fi
if [ "$found" = "" ] ; then
found=`find /usr/share/sgml -name docbookx.dtd`
fi
if [ "$found" = "" ] ; then
echo could not locate docbookx.dtd drom DocBook XML
exit 1
fi
dtd421=""
for dtd in $found; do
check=`grep '//OASIS//DTD DocBook XML V4.1.2//EN' $dtd`
if [ "$check" != "" ] ; then
dtd421=$dtd
break
fi
done
if [ "$dtd421" = "" ] ; then
echo could not locate version 4.1.2 of DocBook XML
exit 1
fi
docbookdir=`dirname $dtd421`
echo Found DocBook XML 4.1.2 DTD in $docbookdir
if [ ! -w $docbookdir ] ; then
echo Cannot write to $docbookdir
exit 2
fi
xmlcatalog --noout --add "public" \
"-//OASIS//ELEMENTS DocBook XML Information Pool V4.1.2//EN" \
"file://$docbookdir/dbpoolx.mod" $CATALOG
xmlcatalog --noout --add "public" \
"-//OASIS//DTD DocBook XML V4.1.2//EN" \
"file://$docbookdir/docbookx.dtd" $CATALOG
xmlcatalog --noout --add "public" \
"-//OASIS//ENTITIES DocBook XML Character Entities V4.1.2//EN" \
"file://$docbookdir/dbcentx.mod" $CATALOG
xmlcatalog --noout --add "public" \
"-//OASIS//ENTITIES DocBook XML Notations V4.1.2//EN" \
"file://$docbookdir/dbnotnx.mod" $CATALOG
xmlcatalog --noout --add "public" \
"-//OASIS//ENTITIES DocBook XML Additional General Entities V4.1.2//EN" \
"file://$docbookdir/dbgenent.mod" $CATALOG
xmlcatalog --noout --add "public" \
"-//OASIS//ELEMENTS DocBook XML Document Hierarchy V4.1.2//EN" \
"file://$docbookdir/dbhierx.mod" $CATALOG
xmlcatalog --noout --add "public" \
"-//OASIS//DTD XML Exchange Table Model 19990315//EN" \
"file://$docbookdir/soextblx.dtd" $CATALOG
xmlcatalog --noout --add "public" \
"-//OASIS//DTD DocBook XML CALS Table Model V4.1.2//EN" \
"file://$docbookdir/calstblx.dtd" $CATALOG
xmlcatalog --noout --add "rewriteSystem" \
"http://www.oasis-open.org/docbook/xml/4.1.2" \
"file://$docbookdir" $CATALOG
xmlcatalog --noout --add "rewriteURI" \
"http://www.oasis-open.org/docbook/xml/4.1.2" \
"file://$docbookdir" $CATALOG
xmlcatalog --noout --add "delegatePublic" \
"-//OASIS//ENTITIES DocBook XML" \
"file://$CATALOG" $ROOTCATALOG
xmlcatalog --noout --add "delegatePublic" \
"-//OASIS//DTD DocBook XML" \
"file://$CATALOG" $ROOTCATALOG
xmlcatalog --noout --add "delegateSystem" \
"http://www.oasis-open.org/docbook/" \
"file://$CATALOG" $ROOTCATALOG
xmlcatalog --noout --add "delegateURI" \
"http://www.oasis-open.org/docbook/" \
"file://$CATALOG" $ROOTCATALOG
#
# find the prefix for ISO DocBook entities
#
top=`dirname $docbookdir`
found=`find $top -name iso-amsb.ent`
if [ "$found" = "" ] ; then
found=`find /usr/share/xml -name iso-amsb.ent`
fi
if [ "$found" = "" ] ; then
found=`find $HOME -name iso-amsb.ent`
fi
if [ "$found" = "" ] ; then
found=`find /usr/local -name iso-amsb.ent`
fi
if [ "$found" = "" ] ; then
found=`find /usr/share/sgml -name iso-amsb.ent`
fi
if [ "$found" = "" ] ; then
echo could not locate iso-amsb.ent of ISO DocBook entities
exit 1
fi
entxml=""
for tst in $found; do
check=`grep '<!ENTITY ominus."\⊖">' $tst`
if [ "$check" != "" ] ; then
entxml=$tst
break
fi
done
if [ "$entxml" = "" ] ; then
echo could not locate ISO DocBook entities
exit 1
fi
isodir=`dirname $entxml`
echo Found ISO DocBook entities in $isodir
xmlcatalog --noout --add "public" \
"ISO 8879:1986//ENTITIES Publishing//EN" \
"file://$isodir/iso-pub.ent" $CATALOG
xmlcatalog --noout --add "public" \
"ISO 8879:1986//ENTITIES Greek Letters//EN" \
"file://$isodir/iso-grk1.ent" $CATALOG
xmlcatalog --noout --add "public" \
"ISO 8879:1986//ENTITIES Box and Line Drawing//EN" \
"file://$isodir/iso-box.ent" $CATALOG
xmlcatalog --noout --add "public" \
"ISO 8879:1986//ENTITIES Greek Symbols//EN" \
"file://$isodir/iso-grk3.ent" $CATALOG
xmlcatalog --noout --add "public" \
"ISO 8879:1986//ENTITIES Added Math Symbols: Negated Relations//EN" \
"file://$isodir/iso-amsn.ent" $CATALOG
xmlcatalog --noout --add "public" \
"ISO 8879:1986//ENTITIES Numeric and Special Graphic//EN" \
"file://$isodir/iso-num.ent" $CATALOG
xmlcatalog --noout --add "public" \
"ISO 8879:1986//ENTITIES Alternative Greek Symbols//EN" \
"file://$isodir/iso-grk4.ent" $CATALOG
xmlcatalog --noout --add "public" \
"ISO 8879:1986//ENTITIES Diacritical Marks//EN" \
"file://$isodir/iso-dia.ent" $CATALOG
xmlcatalog --noout --add "public" \
"ISO 8879:1986//ENTITIES Monotoniko Greek//EN" \
"file://$isodir/iso-grk2.ent" $CATALOG
xmlcatalog --noout --add "public" \
"ISO 8879:1986//ENTITIES Added Math Symbols: Arrow Relations//EN" \
"file://$isodir/iso-amsa.ent" $CATALOG
xmlcatalog --noout --add "public" \
"ISO 8879:1986//ENTITIES Added Math Symbols: Ordinary//EN" \
"file://$isodir/iso-amso.ent" $CATALOG
xmlcatalog --noout --add "public" \
"ISO 8879:1986//ENTITIES Russian Cyrillic//EN" \
"file://$isodir/iso-cyr1.ent" $CATALOG
xmlcatalog --noout --add "public" \
"ISO 8879:1986//ENTITIES General Technical//EN" \
"file://$isodir/iso-tech.ent" $CATALOG
xmlcatalog --noout --add "public" \
"ISO 8879:1986//ENTITIES Added Math Symbols: Delimiters//EN" \
"file://$isodir/iso-amsc.ent" $CATALOG
xmlcatalog --noout --add "public" \
"ISO 8879:1986//ENTITIES Added Latin 1//EN" \
"file://$isodir/iso-lat1.ent" $CATALOG
xmlcatalog --noout --add "public" \
"ISO 8879:1986//ENTITIES Added Math Symbols: Binary Operators//EN" \
"file://$isodir/iso-amsb.ent" $CATALOG
xmlcatalog --noout --add "public" \
"ISO 8879:1986//ENTITIES Added Latin 2//EN" \
"file://$isodir/iso-lat2.ent" $CATALOG
xmlcatalog --noout --add "public" \
"ISO 8879:1986//ENTITIES Added Math Symbols: Relations//EN" \
"file://$isodir/iso-amsr.ent" $CATALOG
xmlcatalog --noout --add "public" \
"ISO 8879:1986//ENTITIES Non-Russian Cyrillic//EN" \
"file://$isodir/iso-cyr2.ent" $CATALOG
xmlcatalog --noout --add "delegatePublic" \
"ISO 8879:1986" \
"file://$CATALOG" $ROOTCATALOG
#
# find the prefix for XSLT stylesheets
#
top=`dirname $docbookdir`
found=`find $top -name chunk-common.xsl`
if [ "$found" = "" ] ; then
found=`find /usr/share/xml -name chunk-common.xsl`
fi
if [ "$found" = "" ] ; then
found=`find $HOME -name chunk-common.xsl`
fi
if [ "$found" = "" ] ; then
found=`find /usr/local -name chunk-common.xsl`
fi
if [ "$found" = "" ] ; then
found=`find /usr/share/sgml -name chunk-common.xsl`
fi
if [ "$found" = "" ] ; then
echo could not locate chunk-common.xsl of DocBook XSLT stylesheets
exit 1
fi
xsldir=""
for tst in $found; do
dir=`dirname $tst`
dir=`dirname $dir`
if [ -r $dir/html/docbook.xsl -a -r $dir/common/l10n.xml ]; then
xsldir=$dir
break
fi
done
if [ "$xsldir" = "" ] ; then
echo could not locate DocBook XSLT stylesheets
exit 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
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
#
#
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]