<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.26.0">
</HEAD>
<BODY>
On Tue, 2011-03-22 at 13:23 -0700, Dan Nicholson wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
On Tue, Mar 22, 2011 at 10:34 AM, Gaetan Nadon &lt;<A HREF="mailto:memsize@videotron.ca">memsize@videotron.ca</A>&gt; wrote:
&gt; On Mon, 2011-03-21 at 17:46 -0700, Dan Nicholson wrote:
&gt;
&gt; I'm not volunteering to do it, but I always thought it would be nice
&gt; if the doc macros actually tried to generate a test doc instead of
&gt; just checking for tools in the path. It's fairly easy to get xmlto in
&gt; your path but actually have a hosed up docbook toolchain.
&gt;
&gt; There has been attempts to do that. It brings its own problems.
&gt; That amounts to &quot;testing&quot; the software to see if it works well enough.
&gt;
&gt; This is done in the compiler world to test for features or behaviors.
&gt; This world is well tested, highly backward compatible. Not so for doctools.
&gt;
&gt; In order to have a meaningful test (other than a zero byte file), one
&gt; would require something like this:
&gt; &lt;!DOCTYPE book PUBLIC &quot;-//OASIS//DTD DocBook XML V4.3//EN&quot;
&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;<A HREF="http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd</A>&quot;&gt;
&gt;
&gt; Note the version number. This would eventually break when 4.3 is no longer
&gt; available. By design Docbook is meant not to be backward compatible from
&gt; one major version to another. In our case, util-macros would eventually
&gt; cease
&gt; to build older versions creating hard to diagnose problems.
&gt;
&gt; Currently we test for the path and optionally a version number.
&gt; Nothing prevents us from adding additional tests, providing we are
&gt; sure it works correctly on all platforms and across time as well.

Do we not require a certain version of Docbook for our documents?
Shouldn't we use that version to test? If the user has xmlto installed
but Docbook is 4.2, then the docs could fail anyway, right?
</PRE>
</BLOCKQUOTE>
The macros have to be backward compatible. In 3 years from now, no one will have<BR>
4.3 installed, so we will need to move up to 4.8. Building older versions of tarballs<BR>
with older versions of docbook will not be possible. <BR>
<BR>
The version specified has to match exactly, no &gt;= stuff.
<BLOCKQUOTE TYPE=CITE>
<PRE>

$ cat &gt; blah.xml &lt;&lt; &quot;EOF&quot;
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;!DOCTYPE article PUBLIC &quot;-//OASIS//DTD DocBook XML V6.0//EN&quot;
          &quot;<A HREF="http://www.oasis-open.org/docbook/xml/6.0/docbookx.dtd">http://www.oasis-open.org/docbook/xml/6.0/docbookx.dtd</A>&quot;&gt;
&lt;article&gt;
  &lt;para&gt;This is a test&lt;/para&gt;
&lt;/article&gt;
EOF
$ xmlto html blah.xml 2&gt;/dev/null
$ echo $?

&gt; Right now, we have a docbook feature which only works with a recent version
&gt; of docbook-xsl as documentation in the README:
&gt;
&gt; The pdf/ps &quot;inside the document&quot; references only started working with
&gt; docbook-xsl v 1.76.1 which is not yet available to your favorite O/S.
&gt; In xorg-fo.xsl, insert.olink.pdf.frag must be set to zero which allows
&gt; the reference to at least point to the top of the document.
&gt;
&gt; I can't think of any test to verify the feature works or not. It would be
&gt; nice if the technology
&gt; had some built-in design to do that. I agree with your requirement but the
&gt; implementation
&gt; is not trivial, even when possible.

It's not _too_ hard to check the version. With xmlto:

$ cat &gt; bar.xml &lt;&lt; &quot;EOF&quot;
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;!DOCTYPE article PUBLIC &quot;-//OASIS//DTD DocBook XML V4.5//EN&quot;
          &quot;<A HREF="http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd</A>&quot;&gt;
&lt;article&gt;
  &lt;para&gt;This is a test&lt;/para&gt;
&lt;/article&gt;
EOF
$ cat &gt; bar.xsl &lt;&lt; &quot;EOF&quot;
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;xsl:stylesheet xmlns:xsl=&quot;<A HREF="http://www.w3.org/1999/XSL/Transform">http://www.w3.org/1999/XSL/Transform</A>&quot;
                version=&quot;1.0&quot;&gt;
  &lt;xsl:import href=&quot;<A HREF="http://docbook.sourceforge.net/release/xsl/1.76.1/html/docbook.xsl/&gt;">http://docbook.sourceforge.net/release/xsl/1.76.1/html/docbook.xsl&quot;/</A>&gt;
&lt;/xsl:stylesheet&gt;
EOF
$ xmlto html -x bar.xsl bar.xml 2&gt;/dev/null
$ echo $?
1

With xsltproc it's even simpler because you can just use the
stylesheet URI directly:

$ xsltproc --nonet
<A HREF="http://docbook.sourceforge.net/release/xsl/1.76.1/html/docbook.xsl">http://docbook.sourceforge.net/release/xsl/1.76.1/html/docbook.xsl</A>
bar.xml 2&gt;/dev/null
$ echo $?
4

It's not trivial, but I think this could be a nice feature. I was
working on this on my laptop a long time ago when the doc macros were
very different, but I'll see if I can dig it up.
</PRE>
</BLOCKQUOTE>
No objection in making better checks. We need to be really sure the code will not break<BR>
as time moves forward. 
<BLOCKQUOTE TYPE=CITE>
<PRE>

--
Dan
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>