This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: additional line(s) in <screen> and <synopsis>
- From: Peter Kullmann <p dot kullmann at arenae dot ch>
- To: Olivier Chapuis <olivier dot chapuis at free dot fr>
- Cc: Docbook-Apps <docbook-apps at lists dot oasis-open dot org>
- Date: Sat, 18 Jan 2003 08:58:03 +0100
- Subject: Re: DOCBOOK-APPS: additional line(s) in <screen> and <synopsis>
- Organization: ARENAE Consulting AG
- References: <20030117221851.GA11001@snoopy.parislyon>
On Fri, 2003-01-17 at 23:18, Olivier Chapuis wrote:
> Hello,
>
> I use xsltproc/saxon, docbook-xsl-1.58.1 and PassiveTex/FOP for ps/pdf
> output (I am new to docbook; I try to see if it is a good idea to use
> "docbook" for our doc in the place of man page for our project. At
> present time I am disappointed by the "print" output, but I like the
> html one. But this is not the subject of this mail).
>
<snip>
> Can I fix that pbs by "fo style-sheet customization" or/and by
> changing a magic line in PassiveTex source? I.e., where is the
> bug?
>
> Thanks, Olivier
>
I'm using the following templates in my customization layer for this
issue:
<!-- normalized screens -->
<xsl:template match="screen/text()">
<xsl:variable name="before" select="preceding-sibling::node()"/>
<xsl:variable name="after" select="following-sibling::node()"/>
<xsl:variable name="conts" select="."/>
<xsl:variable name="contsl">
<xsl:choose>
<xsl:when test="count($before) = 0">
<xsl:call-template name="remove-lf-left">
<xsl:with-param name="astr" select="$conts"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$conts"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="contslr">
<xsl:choose>
<xsl:when test="count($after) = 0">
<xsl:call-template name="remove-ws-right">
<xsl:with-param name="astr" select="$contsl"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$contsl"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="$contslr"/>
</xsl:template>
<!-- eats linefeeds from the left -->
<xsl:template name="remove-lf-left">
<xsl:param name="astr"/>
<xsl:choose>
<xsl:when test="starts-with($astr,'
') or
starts-with($astr,'
')">
<xsl:call-template name="remove-lf-left">
<xsl:with-param name="astr" select="substring($astr, 2)"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$astr"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- eats whitespace from the right -->
<xsl:template name="remove-ws-right">
<xsl:param name="astr"/>
<xsl:variable name="last-char">
<xsl:value-of select="substring($astr, string-length($astr), 1)"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="($last-char = '
') or
($last-char = '
') or
($last-char = ' ') or
($last-char = '	')">
<xsl:call-template name="remove-ws-right">
<xsl:with-param name="astr"
select="substring($astr, 1, string-length($astr) - 1)"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$astr"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>