[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Adding a border around a DocBook <imageobject> in PDF output
<figure pgwide="1">
<title>some caption</title>
<mediaobject role="screenshot">
<imageobject>
<imagedata fileref="media/usrprf.export1.png" scalefit="1" align="center" width="90%"/>
</imageobject>
</mediaobject>
</figure>
<xsl:template match="mediaobject[@role='screenshot']">
<fo:block border="0.5pt solid black" width="90%">
<xsl:apply-imports/>
</fo:block>
</xsl:template>
Indeed, there is not an attribute-set for mediaobject itself. I suspect that because there are so many attributes on the graphics elements that must be supported, that another attribute-set might introduce complicated interactions.Fortunately, there is an easy way to get a border. Any time you want to add features outside of an element itself, you can use xsl:apply-imports. Try this:<xsl:template match="mediaobject">
<fo:block border="0.5pt solid black">
<xsl:apply-imports/>
</fo:block>
</xsl:template>This will add a fo:block container with a border, and put the image inside it. Unless you have already customized the template matching on mediaobject, the apply-imports will fall back to the original DocBook template for it.From: Christopher BROWNSent: Wednesday, November 07, 2012 9:08 AMSubject: [docbook-apps] Adding a border around a DocBook <imageobject> in PDF outputHello,I have some screenshots to include as part of a user manual I'm compiling with DocBook, and several are on white backgrounds and contain mainly text, so doesn't mix well with other text layout on the page. I tried to find out how to add a border by regarding DocBook XSL documentation, specifically:..and the best I could do was following the second link, add a border around the <figure> element (so it not only goes around the image, but also around the <title>, leaving a lot of whitespace around the image).I then tried working out how add borders using the first link instead, so that I'd only outline the image itself, but none of <mediaobject>, <imageobject>, or <imagedata> appear in the list of elements that recognize the attribute-sets referred to there. A little further on, it says "you will want to find out where the outer fo:block is output..." but I don't know what I'm looking for based on that advice, nor how to find it, nor what to do with it (I'm a bit worried that I might accidentally clobber something too by matching the template in a higher-precedence customization layer).
Thanks,
Christopher
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]