<?xml version="1.0"?>
<!-- ============================================================ -->
<!--                                                              -->
<!-- 	This file makes a part of RenderX XSL Test Suite          -->
<!--                                                              -->
<!--    Author: Alexander Peshkov                                 -->
<!--                                                              -->
<!--    (c) RenderX, 2003                                         -->
<!--                                                              -->
<!-- ============================================================ -->
<document>
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
           xmlns:dc="http://purl.org/dc/elements/1.1/"
           xmlns:dcterms="http://purl.org/dc/terms/"
           xmlns:db="http://www.oasis-open.org/docbook/xml/4.2/">
    <rdf:Description rdf:about="http://xep.xattic.com/testsuite/usecases/image-scale.xml">
        <dc:creator>Alexander Peshkov</dc:creator>
        <dc:title>Scaling images using <db:parameter>scale-to-fit</db:parameter></dc:title>
        <dc:description>
          <db:para>
            Scales down images using <db:parameter>scale-to-fit</db:parameter> value
            of <db:sgmltag class='attribute'>content-width</db:sgmltag>
            and <db:sgmltag class='attribute'>content-height</db:sgmltag> traits.
          </db:para>
        </dc:description>
        <dc:date>2003-07-07</dc:date>
        <dcterms:requires rdf:resource="http://xep.xattic.com/testsuite/usecases/generic.xsl"/>
        <dcterms:requires rdf:resource="http://xep.xattic.com/testsuite/usecases/image-scale.xsl"/>
    </rdf:Description>
  </rdf:RDF>
  <title>Scaling images using <code>scale-to-fit</code></title>
  <para>
	Both <code>content-width</code> and <code>content-height</code> properties can have
	a special value <code>scale-to-fit</code> which allows you to automatically scale down
	images which are wider or taller then necessary.
    <citation>
      <ulink url="http://www.w3.org/TR/2001/REC-xsl-20011015/slice7.html#content-height">XSL FO Recommendation, Chapter 7.14.2 "content-height"</ulink>
    </citation>
    <citation>
      <ulink url="http://www.w3.org/TR/2001/REC-xsl-20011015/slice7.html#content-width">XSL FO Recommendation, Chapter 7.14.3 "content-width"</ulink>
    </citation>
  </para>
  <para>
	In the table below every row has <code>height="300px"</code>
	and every image cell has <code>width="300px"</code>.
	Example of <code>fo:external-graphic</code> element used to insert images cited below:
	<codeblock>
	  &lt;fo:external-graphic content-width="scale-to-fit"
	                       content-height="100%"
	                       width="100%"
	                       scaling="uniform"/&gt;
	                       src="url(Images/bud400x300.jpg)"
	</codeblock>
  </para>
  <para>
	Thus we want all wider images to scale down while small images must stay intact.
	In the table below only images in first and third rows must be scaled.
	Table cells in the right column contain intrinsic information about images placed in the left column.
  </para>
  <para font-weight="bold">Note that scaling works both for raster and SVG images.</para>
		<table space-after="20pt">
          <colspec text-align="center" display-align="center" colwidth="300px"/>
          <colspec/>			
			<table-body>
				<row height="300px">
					<entry>
						<image src="Images/bud400x300.jpg"/>
					</entry>
					<entry>
						<para font-style="italic">Bud of an alder-tree [JPEG].</para>
						<para>This image intrinsic width is 400 pixels and it's height is 300 pixels.</para>
					</entry>
				</row>
				<row height="300px">
					<entry>
						<image src="Images/butterfly-small.jpg"/>
					</entry>
					<entry>
						<para font-style="italic">Butterfly [JPEG].</para>
						<para>This image intrinsic width is 160 pixels and it's height is 120 pixels.</para>
					</entry>
				</row>
				<row height="300px">
					<entry>
						<image src="Images/sentence.svg"/>
					</entry>
					<entry>
						<para font-style="italic">Phrase analysis [SVG].</para>
						<para>This image intrinsic width is 400 pixels and it's height is 250 pixels.</para>
					</entry>
				</row>
				<row height="300px">
					<entry>
						<image src="Images/moscow_0595-small.svg"/>
					</entry>
					<entry>
						<para font-style="italic">Temperatures graphic [SVG].</para>
						<para>This image intrinsic width is 150 pixels and it's height is 150 pixels.</para>
					</entry>
				</row>
			</table-body>
		</table>

</document>