Re: [docbook-apps] mediaobject that will display as a block

From
Bob Stayton <>
Date
2011-12-01T17:42:54+00:00
ID
003601ccb050$a4898550$6600a8c0@pazu
Thread
Re: [docbook-apps] mediaobject that will display as a block
Hi Paul,

The formal.object.properties attribute-set is 
applied to formal objects, which are numbered and titled elements 
including figures, tables, examples, and equations.  It is not applied 
to mediaobject with caption.

 

I think the easiest way to do this would be to 
customize the template that matches on caption.  It is a very short 
template, found in fo/graphics.xsl.  I changed it to add two keep 
properties to the fo:block:

 

<xsl:template match="caption">
  
<fo:block keep-with-previous.within-column="always" 
keep-together.within-column="always">
    <xsl:if 
test="@align = 'right' or @align = 'left' or 
@align='center'">
      <xsl:attribute 
name="text-align"><xsl:value-of
                         
select="@align"/></xsl:attribute>
    
</xsl:if>
    <xsl:apply-templates/>
  
</fo:block>
</xsl:template>

It seems to work in FOP.

 

Bob Stayton
Sagehill Enterprises


 

 

  
----- Original Message ----- 

  
From: 
  PC Thoms 

  
To:  
  

  
Sent: Thursday, December 01, 2011 7:13 
  AM

  
Subject: [docbook-apps] mediaobject that 
  will display as a block

  

I'm hoping to keep a <mediaobject> and 
  <title/caption> on the same page in the FO output to pdf.
  
Using Oxygenxml v13 with Saxon6.5.5 with Apache FOP.

  
Have tried <mediaobject> and <informalobject> without success 
  as some of the <title/caption> flows to the next page. 

  
How can I avoid this?

  
I have 

  

  

  
<mediaobject>

  
   <imageobject>

  
     <imagedata/>

  
     <title/caption/>
  
   </imageobject>
  
</mediaobject>

  

  
that I want to keep together on the same page when transformed to 
  pdf.

  
Simply what I getting at the end of a pdf is the following:

  
<imagedata/>

  
page-break

  
<caption/>

  
and I want to avoid the break in between.

  

  
I have also added the formal.object.properties parameter to the list 
  in Oxygenxml, as it was not listed - to no avail.

  
With thanks

  
Paul