OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] whitespace handling in manpages stylesheet



>Are there any parameters that control how whitespace in handled in the
>production of function synopses in manpages? The default stylesheet

I found a similar problem with listitems in an itemizedlist context
and was able to fix it (for this particular case) by using
normalize_space. That sort of works for the functionsynopis too.
The templates I used are:

----------------------------------------------------------------------
<!-- cut out whitespace in items in a list -->
<xsl:template match="itemizedlist/listitem">
  <xsl:text>\(bu&#10;</xsl:text>
  <xsl:variable name="content">
    <xsl:apply-templates mode="list"/>
  </xsl:variable>
  <xsl:value-of select="normalize-space($content)"/>
  <xsl:text>&#10;</xsl:text>
  <xsl:if test="position()!=last()">
    <xsl:text>.TP&#10;</xsl:text>
  </xsl:if>
</xsl:template>

<!-- cut out whitespace in funcdef/paramdef -->
<xsl:template match="paramdef|funcdef">
  <xsl:variable name="rcontent">
    <xsl:apply-templates select="*|./*|text()"/>
  </xsl:variable>
  <xsl:variable name="content">
    <xsl:value-of select="normalize-space($rcontent)"/>
  </xsl:variable>
  <xsl:call-template name="replace-string">
    <xsl:with-param name="content" select="$content"/>
    <xsl:with-param name="replace" select="' '"/>
    <xsl:with-param name="with" select="'\ '"/>
  </xsl:call-template>
  <xsl:if test="local-name(.) = 'paramdef' and
          (following-sibling::paramdef or following-sibling::varargs)">
    <xsl:text>, </xsl:text>
  </xsl:if>
</xsl:template>
-----------------------------------------------------------------------

Does this seem correct, or is it likely to have unfortunate
side-effects?

The function prototype looks almost right but there are still some
extra spaces left hanging around. I think because the normalise_space
doesn't act on the <function>, which is a child of the <funcdef>. I'm
now wondering how to get at the content of the function element in the
function template. I tried:

----------------------------------------------------------------------
<xsl:template match="function[not(ancestor::command)]">
  <xsl:variable name="rcontent">
    <xsl:value-of select="."/>
  </xsl:variable>
  <xsl:variable name="content">
    <xsl:value-of select="normalize-space($rcontent)"/>
  </xsl:variable>
  <xsl:apply-templates mode="bold" select="$rcontent"/>
</xsl:template>
----------------------------------------------------------------------

But rcontent doesn't seem to contain anything as a result, since the
function disappears from the output.

Can anyone offer any advice on whether this is the right way to
approach this problem, and if so, how to get at the content of the
function in the above template?

Brian McGurk






[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]