Thanks David,
Hmm, it does seem to work… but, as Bob suggested, only if I set the height attribute to something specific.
In other words, height="100%" leaves the image spilling into the bottom margin.
height="7in" seems to work for my page size as long as the image is alone with no text.
Mark
On 06 Jan 2014, at 16:09, David Cramer <> wrote:
> Hi Mark,
> I'd edit the fo and run it through your fo processor to confirm that
> scale-down-to-fit gives the result you want.
>
> For production you'll want to customize the templates from graphics.xsl
> to make the right stuff come out in the fo. In particular the templates
> <xsl:template name="image.content.width"> and <xsl:template
> name="image.content.height"> are important.
>
> Really this should be a feature of the stock xslts though.
>
> Regards,
> David
>
> On 01/05/2014 03:58 AM, Mark Craig wrote:
>> Thanks Bob and David,
>>
>> What's the right way to pass the "scale-down-to-fit" attribute value
>> into the FO?
>>
>> I've tried adding them as attributes on <imagedata> with some XSL that I
>> was using before to handle wide images. Here's the template where
>> xmlns:db="http://docbook.org/ns/docbook" exclude-result-prefixes="db":
>>
>> <xsl:template match="db:imagedata">
>> <xsl:element name="imagedata" namespace="http://docbook.org/ns/docbook">
>> <xsl:apply-templates select="node()|@*"/>
>> <xsl:attribute name="contentdepth">scale-down-to-fit</xsl:attribute>
>> <xsl:attribute name="contentwidth">scale-down-to-fit</xsl:attribute>
>> <xsl:attribute name="align">center</xsl:attribute>
>> </xsl:element>
>> </xsl:template>
>>
>> After this transformation and running the stylesheets,
>> text-align="center" shows up in the resulting .fo, but the others are
>> null: content-width="" content-height="".
>>
>> Is there a stylesheet customization I should apply to allow those
>> attribute values to pass through to the FO?
>>
>> Or do I need to edit the FO after it gets generated?
>>
>> Regards,
>> Mark