[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: external-graphic attributes question

Subject: Re: external-graphic attributes question
From: "Tony Graham" <tgraham@xxxxxxxxxx>
Date: Tue, 12 Jul 2011 16:50:28 +0100 (IST)
Re:  external-graphic attributes question
On Tue, July 12, 2011 2:40 pm, Trevor Nicholls wrote:
> I am looking at a piece of XSL-FO which defines a block graphic for a PDF
> document and which is probably overspecified.
>
> The generated fo contains the following:
>
> <fo:block text-align="center" display-align="center">
>   <fo:external-graphic vertical-align="middle" src="url({$src})"
> height="{$h}" width="{$w}" content-height="scale-to-fit"
> content-width="scale-to-fit" />
> </fo:block>
>
> When I look at the derivations of $h and $w it appears that they will
> always
> be either the actual dimensions of the graphic file, or values (scaled up
> or
> down) which preserve the original aspect ratio. Is there any point in
> supplying both height and width together with content height and content
> width?

See the definition of fo:external-graphic [3].

If you omit 'content-height' [1] or 'content-width' [2], then they have
their initial values of 'auto', which means the content should be shown at
its intrinsic height and width.  So you'd end up with the external graphic
at its intrinsic size in a space some multiple of the intrinsic size, as
determined by 'height' and 'width'.  When 'height' and 'width' are less
than the intrinsic size, you'd normally (depending on the 'overflow'
property value) see just some portion of the external graphic.

You could safely omit one of 'content-height' or 'content-width'.  From [3]:

   If one of the content-height or content-width is not "auto", the
   same scale factor (as calculated from the specified non-auto value)
   is applied equally to both directions.

You could also omit the corresponding 'height' or 'width' property since
the initial value of 'auto' would let the formatter set the dimension to
fit the scaled image.

Regards,


Tony Graham                                   tgraham@xxxxxxxxxx
Consultant                                 http://www.mentea.net
Mentea       13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
 --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
    XML, XSL FO and XSLT consulting, training and programming

[1] http://www.w3.org/TR/xsl11/#content-height
[2] http://www.w3.org/TR/xsl11/#content-width
[3] http://www.w3.org/TR/xsl11/#fo_external-graphic

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.