This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: XSL customization layer question


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() &gt; 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() &gt; 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]