Coming from a Linux distribution and having copy/pasted from a number of examples across the net, I am doing the following to include DocBook style in my XSL files (processed with xsltproc):
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="/usr/share/xml/docbook/stylesheet/nwalsh/html/docbook.xsl"/>
...
This works great as long as "docbook.xsl" is at the specified place. Of course, it is not always. E.g., on Mac OSX with MacPorts, it needs to be:
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="/opt/local/share/xsl/docbook-xsl/html/docbook.xsl"/>
...
A totally different path. I've looked through the net to see whether a "file exists" functionality exists for XSL (apparently not yet) or whether conditional includes are possible (apparently not).
So, short of having to dynamically create the XSL depending on where the "docbook.xsl" really is (I would probably do that via a Makefile), are there any other possibilities to have the file imported from the correct location without too much hassle?
Edit / Answer: Dimitre pointed the right way, and after reading a bit there and in the general catalog files on my systems, the short answer to the specific problem is to use:
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"/>
Case closed, problem solved. And writing own catalogs is postponed to another time :-)
So, short of having to dynamically create the XSL depending on where the "docbook.xsl" really is (I would probably to that via a Makefile), are there any other possibilities to have the file imported from the correct location without too much hassle?
XML catalogs are intended to solve this problem (among others).
Read more here.