Subject: Re: [xsl] external-graphic attributes question From: "Tony Graham" <tgraham@xxxxxxxxxx> Date: Tue, 12 Jul 2011 16:50:28 +0100 (IST) |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] external-graphic attributes q, Trevor Nicholls | Thread | [xsl] why matches($title,'.*?(\.|,), Alex Muir |
[xsl] external-graphic attributes q, Trevor Nicholls | Date | [xsl] why matches($title,'.*?(\.|,), Alex Muir |
Month |