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

From
<>
Date
2011-12-01T18:37:16+00:00
ID
Thread
Re: [docbook-apps] mediaobject that will display as a block
Bob,

It seems to me that this change should be made to the standard DocBook XSL 
sheet? 

 

I cannot think of a situation where you would not want captions stuck 
to mediaobjects on the same page. Maybe if the caption was a paragraph long? 
Maybe it would be too constrictive?

 

Regards,

Dean Nelson

 

In a message dated 12/1/2011 9:43:00 A.M. Pacific Standard Time, 
 writes:

  
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