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] styling refentry blocks


Hi Paul,
The problem is that your template is replacing the original template for 
refentry, which is in fo/refentry.xsl.  The original template output an id 
attribute that is necessary for references.  In there, you'll see this bit:

  <xsl:variable name="id">
    <xsl:call-template name="object.id"/>
  </xsl:variable>

and this bit:

    <fo:block id="{$id}">
      <xsl:apply-templates/>
    </fo:block>

That will restore the missing id targets for references.

Or you could just replace xsl:apply-templates in your template with 
xsl:apply-imports, which will instead wrap your fo:block with style 
attributes around the fo:block generated by the stock template (which will 
have the id). Both approaches should work.  The latter means other features 
of the original refentry template will be retained, and updates will 
automatically be used.

Regarding turning off verbatim styling inside refentry, each attribute value 
in an attribute-set can be computed with a conditional xsl:choose statement, 
which is evaluated each time the attribute-set is applied.  Something like 
this:

<xsl:attribute-set name="monospace.verbatim.properties">
  <xsl:attribute name="background-color">
    <xsl:choose>
      <xsl:when test="ancestor::refentry">inherit<xsl:when>
      <xsl:otherwise>grey</xsl:otherwise>
    </xsl:choose>
  </xsl:attribute>
</xsl:attribute-set>

Bob Stayton
Sagehill Enterprises
bobs@sagehill.net


----- Original Message ----- 
From: "Paul Suckling" <paul.suckling@gmail.com>
To: <docbook-apps@lists.oasis-open.org>
Sent: Monday, April 27, 2009 5:55 AM
Subject: [docbook-apps] styling refentry blocks


>I am writing a user guide for some software which has an api. We use
> refentry blocks to define the api. We have taken the decision to place
> the refentry blocks within the relevant sections of the user guide,
> interspersing them throughout the text of the document. To make them
> stand out as different from the main text, we'd like to give the
> refentry blocks a different background colour and border.
>
> I have tried adding the following to my customisation layer:
>
>  <!-- make refentrys have a grey background and border -->
>  <xsl:template match="refentry">
>   <fo:block background-color="#E8E8E8" border-width="1pt"
> border-style="solid" border-color="#575757" padding="3pt">
>    <xsl:apply-templates/>
>   </fo:block>
>  </xsl:template>
>
> Style-wise, it works. However, it breaks all references within the
> refentry blocks. For example, I get the lots of warning which look
> like the following:
>
> 27-Apr-2009 13:39:13 org.apache.fop.area.AreaTreeHandler 
> addOffDocumentItem
> WARNING: Bookmarks: Unresolved id reference "RE_Command_NAME" found.
>
> and the refentry blocks no longer appear in the bookmarks of the PDF 
> version.
>
> As an added complication, we have a similar background colour and
> border styling applied to verbatim blocks (via shade.verbatim = 1 and
> its attribute set). This means that our synopsis element within our
> refsynopsisdiv already has a box and border. We'd like to redefine (or
> remove) this styling within refentry blocks only.
>
> I'd be grateful for advice on how to achieve what I want. Thank you.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
>
>
> 



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