Yes, I was thinking the same thing.  I think caption needs its own 
attribute-set so customizing its behavior can be done without customizing the 
template.  I would include keep-with-previous, but I think keep-together might 
be overly intrusive for long captions.  But with an attribute-set, changing it 
would be easy.

Bob Stayton
Sagehill Enterprises
[email protected]


  ----- Original Message ----- 
  From: [email protected] 
  To: [email protected] ; [email protected] ; [email protected] 
  Sent: Thursday, December 01, 2011 10:36 AM
  Subject: 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, 
[email protected] 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
    [email protected]


      ----- Original Message ----- 
      From: PC Thoms 
      To: [email protected] 
      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

Reply via email to