This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: XSL customization layer question
- From: Bob Stayton <bobs at caldera dot com>
- To: Dennis Grace <dgrace at us dot ibm dot com>, docbook-apps at lists dot oasis-open dot org
- Date: Tue, 26 Feb 2002 15:34:36 -0800
- Subject: Re: DOCBOOK-APPS: XSL customization layer question
- References: <OFFC7E5B88.B85E2FF9-ON85256B6C.007DAB2F@raleigh.ibm.com>
On Tue, Feb 26, 2002 at 05:17:27PM -0600, Dennis Grace wrote:
> I'm lost. I need to add a customization layer for use with Martijn van
> Beers's db2man.xsl that aligns additional command synopses in line
> something like they do in the conversion to html. I'm using Norm Walsh's
> docbook-xsl-1.49 with the latest db2man.
>
> To clarify, I have a man page with a multi-level synopsis that looks
> something like this (this is a simplified version):
>
> command [-a | --alpha] [-b | --beta]
> command -c | --charlie
> command -d | --delta
> command --help
>
> If I process the xml using xsltproc and Norm's xslt, I get what I expect.
> If I use db2man, it comes out something like this:
>
> command [-a | --alpha] [-b | --beta] command -c | --charlie command
> -d | --delta command --help
>
> I figured I needed a template call in the synop.xsl file, but I can't
> figure exactly what it should say. I foolishly tried
>
> <xsl:template match="cmdsynopsis">
> <xsl:if test="position()>1"><xsl:value-of select
> ="$cmdsynopsis.hanging.indent"/></xsl:if>
> <xsl-apply-templates/>
> </xsl:template>
>
> Naturally, this just put in the string equivalent of
> cmdsynopsis.hanging.indent from the common/common.xsl file, which is 4pi.
>
> So how do I tell it to put in a carriage return and indent?
Two things:
1. The test attribute won't respond properly to '>';
you should use test="position() > 1". Fun, huh?
2. If you are looking to output literal whitespace, then use
the <xsl:text> element:
<xsl:template match="cmdsynopsis">
<xsl:if test="position() > 1">
<xsl:text>
</xsl:text></xsl:if>
</xsl:if>
<xsl-apply-templates/>
</xsl:template>
That's carriage return and four space characters
inside the <xsl:text> element.
--
Bob Stayton 400 Encinal Street
Publications Architect Santa Cruz, CA 95060
Technical Publications voice: (831) 427-7796
Caldera International, Inc. fax: (831) 429-1887
email: bobs@caldera.com