This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
inconsistent XSL results (saxon/XT)
- To: DocBook Apps Mailing List <docbook-apps at lists dot oasis-open dot org>
- Subject: DOCBOOK-APPS: inconsistent XSL results (saxon/XT)
- From: Dave Makower <davemak at iclick dot com>
- Date: Wed, 20 Sep 2000 10:06:12 -0400
For XSL processing of docbook XML, we're trying to switch to saxon
from the no-longer-supported XT. For the most part, we've been happy
with the results, as saxon is much faster. However, there is a
significant inconsistency in the output and I'm wondering whether:
(a) XT is right, and saxon needs a bugfix, or
(b) saxon is right, and the docbook stylesheets need to be tweaked.
I've tried to provide as much relevant detail as possible below; my
apologies if it's too verbose.
Here is a sample snippet from a DocBook XML file:
<screen>
<prompt>%</prompt> <userinput>cd ${HOME}/projects/livedemo/</userinput>
<prompt>%</prompt> <userinput>cvs edit ilib</userinput>
<prompt>%</prompt> <userinput>cp /develop/products/releases/clickhr/<replaceable>version</replaceable>/ilib/*.jar ilib</userinput>
<prompt>%</prompt> <userinput>cp /develop/products/releases/clickhr/<replaceable>version</replaceable>/ilib/*.zip ilib</userinput>
</screen>
Here is the output from Saxon (seems like lots of extra whitespace,
which matters because it's inside a <pre> tag):
<pre class="screen">
<tt>%</tt> <b><tt>cd ${HOME}/projects/livedemo/</tt></b>
<tt>%</tt> <b><tt>cvs edit ilib</tt></b>
<tt>%</tt> <b><tt>cp /develop/products/releases/clickhr/<i><tt>version</tt></i>/ilib/*.jar ilib
</tt>
</b>
<tt>%</tt> <b><tt>cp /develop/products/releases/clickhr/<i><tt>version</tt></i>/ilib/*.zip ilib
</tt>
</b>
</pre>
Here is the output from XT (more like what I wanted):
<pre class="screen">
<tt>%</tt> <b><tt>cd ${HOME}/projects/livedemo/</tt></b>
<tt>%</tt> <b><tt>cvs edit ilib</tt></b>
<tt>%</tt> <b><tt>cp /develop/products/releases/clickhr/<i><tt>version</tt></i>/ilib/*.jar ilib</tt></b>
<tt>%</tt> <b><tt>cp /develop/products/releases/clickhr/<i><tt>version</tt></i>/ilib/*.zip ilib</tt></b>
</pre>
Here are (I believe) the relevant templates from the docbook XSL stylesheets:
From "verbatim.xsl":
<xsl:template match="programlisting|screen|literallayout[@class='monospaced']">
<pre class="{name(.)}"><xsl:apply-templates/></pre>
</xsl:template>
From "inline.xsl":
<xsl:template name="inline.monoseq">
<xsl:param name="content">
<xsl:apply-templates/>
</xsl:param>
<tt><xsl:copy-of select="$content"/></tt>
</xsl:template>
<xsl:template name="inline.boldmonoseq">
<xsl:param name="content">
<xsl:apply-templates/>
</xsl:param>
<b><tt><xsl:copy-of select="$content"/></tt></b>
</xsl:template>
<xsl:template name="inline.italicmonoseq">
<xsl:param name="content">
<xsl:apply-templates/>
</xsl:param>
<i><tt><xsl:copy-of select="$content"/></tt></i>
</xsl:template>
<xsl:template match="prompt">
<xsl:call-template name="inline.monoseq"/>
</xsl:template>
<xsl:template match="userinput">
<xsl:call-template name="inline.boldmonoseq"/>
</xsl:template>
<xsl:template match="replaceable" priority="1">
<xsl:call-template name="inline.italicmonoseq"/>
</xsl:template>
Any idea what the reason is for this inconsistency, or whose fault it is?
P.S.: As a detail, it might be wise if the templates that turn on monospaced output set a parameter so that redundant <tt> tags don't get put in if, for instance, a replaceable is nested inside a screen or a userinput (or both).
--
+-------------------------------------------------------------------+
| Dave Makower <davemak@iclick.com> |
| Director of Portal Architecture & Development |
+--------------------------------+----------------------------------+
| iClick, Inc. | (914) 872-8030 |
| 120 Bloomingdale Road | (914) 872-8100 fax |
| 3rd Floor | (914) 872-8000 main |
| White Plains, NY 10605 | http://www.iclick.com/ |
+--------------------------------+----------------------------------+