<?xml version="1.0" encoding="utf-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:rx="http://www.renderx.com/XSL/Extensions">
<!-- ============================================================ -->
<!--                                                              -->
<!-- 	This file makes a part of RenderX XSL Test Suite          -->
<!--                                                              -->
<!--    Author: Alexander Peshkov                                 -->
<!--                                                              -->
<!--    (c) RenderX, 2003                                         -->
<!--                                                              -->
<!-- ============================================================ -->
   <fo:layout-master-set>
      <fo:simple-page-master master-name="document-master" margin="0.4in">
         <fo:region-body margin="20pt" padding="0pt"/>
      </fo:simple-page-master>
   </fo:layout-master-set>
   <fo:page-sequence master-reference="document-master">
      <fo:flow flow-name="xsl-region-body" padding="6pt">
  
  
         <fo:block font="bold 16pt Helvetica" space-before="16pt" space-after="16pt" text-align="center" span="all">Scaling images using <fo:wrapper font-family="monospace">scale-to-fit</fo:wrapper>
         </fo:block>
  
         <fo:block font-size="12pt" space-before="6pt" space-after="6pt" text-align="justify" text-indent="16pt">
	Both <fo:wrapper font-family="monospace">content-width</fo:wrapper> and <fo:wrapper font-family="monospace">content-height</fo:wrapper> properties can have
	a special value <fo:wrapper font-family="monospace">scale-to-fit</fo:wrapper> which allows you to automatically scale down
	images which are wider or taller then necessary.
    <fo:block font-size="12pt" font-style="italic" space-before="6pt" space-after="6pt">
      
               <fo:basic-link external-destination="url(http://www.w3.org/TR/2001/REC-xsl-20011015/slice7.html#content-height)" color="#0000C0" text-decoration="underline">XSL FO Recommendation, Chapter 7.14.2 "content-height"</fo:basic-link>
    
            </fo:block>
    
            <fo:block font-size="12pt" font-style="italic" space-before="6pt" space-after="6pt">
      
               <fo:basic-link external-destination="url(http://www.w3.org/TR/2001/REC-xsl-20011015/slice7.html#content-width)" color="#0000C0" text-decoration="underline">XSL FO Recommendation, Chapter 7.14.3 "content-width"</fo:basic-link>
    
            </fo:block>
  
         </fo:block>
  
         <fo:block font-size="12pt" space-before="6pt" space-after="6pt" text-align="justify" text-indent="16pt">
	In the table below every row has <fo:wrapper font-family="monospace">height="300px"</fo:wrapper>
	and every image cell has <fo:wrapper font-family="monospace">width="300px"</fo:wrapper>.
	Example of <fo:wrapper font-family="monospace">fo:external-graphic</fo:wrapper> element used to insert images cited below:
	<fo:block white-space="pre" font-family="monospace">
	  &lt;fo:external-graphic content-width="scale-to-fit"
	                       content-height="100%"
	                       width="100%"
	                       scaling="uniform"/&gt;
	                       src="url(Images/bud400x300.jpg)"
	</fo:block>
  
         </fo:block>
  
         <fo:block font-size="12pt" space-before="6pt" space-after="6pt" text-align="justify" text-indent="16pt">
	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.
  </fo:block>
  
         <fo:block font-size="12pt" space-before="6pt" space-after="6pt" text-align="justify" text-indent="16pt" font-weight="bold">Note that scaling works both for raster and SVG images.</fo:block>
		
         <fo:table-and-caption space-after="4pt">
            <fo:table-caption>
               <fo:block font="bold 10pt Helvetica" keep-with-next="always" space-before="16pt" space-after="6pt" text-align="end"/>
            </fo:table-caption>
            <fo:table border="0.75pt solid black" border-before-width.conditionality="retain" border-after-width.conditionality="retain" space-after="20pt">
               <fo:table-column text-align="center" display-align="center" column-width="300px"/>
               <fo:table-column/>
               <fo:table-body>
				
                  <fo:table-row height="300px">
					
                     <fo:table-cell border="0.25pt solid black" border-before-width.conditionality="retain" border-after-width.conditionality="retain" padding="3pt" text-align="from-table-column()" display-align="from-table-column()">
                        <fo:block>
						
                           <fo:block line-height="1pt">
                              <fo:external-graphic content-width="scale-to-fit" content-height="100%" width="100%" scaling="uniform" src="url(Images/bud400x300.jpg)"/>
                           </fo:block>
					
                        </fo:block>
                     </fo:table-cell>
					
                     <fo:table-cell border="0.25pt solid black" border-before-width.conditionality="retain" border-after-width.conditionality="retain" padding="3pt" text-align="from-table-column()" display-align="from-table-column()">
                        <fo:block>
						
                           <fo:block font-size="12pt" space-before="6pt" space-after="6pt" text-align="justify" text-indent="16pt" font-style="italic">Bud of an alder-tree [JPEG].</fo:block>
						
                           <fo:block font-size="12pt" space-before="6pt" space-after="6pt" text-align="justify" text-indent="16pt">This image intrinsic width is 400 pixels and it's height is 300 pixels.</fo:block>
					
                        </fo:block>
                     </fo:table-cell>
				
                  </fo:table-row>
				
                  <fo:table-row height="300px">
					
                     <fo:table-cell border="0.25pt solid black" border-before-width.conditionality="retain" border-after-width.conditionality="retain" padding="3pt" text-align="from-table-column()" display-align="from-table-column()">
                        <fo:block>
						
                           <fo:block line-height="1pt">
                              <fo:external-graphic content-width="scale-to-fit" content-height="100%" width="100%" scaling="uniform" src="url(Images/butterfly-small.jpg)"/>
                           </fo:block>
					
                        </fo:block>
                     </fo:table-cell>
					
                     <fo:table-cell border="0.25pt solid black" border-before-width.conditionality="retain" border-after-width.conditionality="retain" padding="3pt" text-align="from-table-column()" display-align="from-table-column()">
                        <fo:block>
						
                           <fo:block font-size="12pt" space-before="6pt" space-after="6pt" text-align="justify" text-indent="16pt" font-style="italic">Butterfly [JPEG].</fo:block>
						
                           <fo:block font-size="12pt" space-before="6pt" space-after="6pt" text-align="justify" text-indent="16pt">This image intrinsic width is 160 pixels and it's height is 120 pixels.</fo:block>
					
                        </fo:block>
                     </fo:table-cell>
				
                  </fo:table-row>
				
                  <fo:table-row height="300px">
					
                     <fo:table-cell border="0.25pt solid black" border-before-width.conditionality="retain" border-after-width.conditionality="retain" padding="3pt" text-align="from-table-column()" display-align="from-table-column()">
                        <fo:block>
						
                           <fo:block line-height="1pt">
                              <fo:external-graphic content-width="scale-to-fit" content-height="100%" width="100%" scaling="uniform" src="url(Images/sentence.svg)"/>
                           </fo:block>
					
                        </fo:block>
                     </fo:table-cell>
					
                     <fo:table-cell border="0.25pt solid black" border-before-width.conditionality="retain" border-after-width.conditionality="retain" padding="3pt" text-align="from-table-column()" display-align="from-table-column()">
                        <fo:block>
						
                           <fo:block font-size="12pt" space-before="6pt" space-after="6pt" text-align="justify" text-indent="16pt" font-style="italic">Phrase analysis [SVG].</fo:block>
						
                           <fo:block font-size="12pt" space-before="6pt" space-after="6pt" text-align="justify" text-indent="16pt">This image intrinsic width is 400 pixels and it's height is 250 pixels.</fo:block>
					
                        </fo:block>
                     </fo:table-cell>
				
                  </fo:table-row>
				
                  <fo:table-row height="300px">
					
                     <fo:table-cell border="0.25pt solid black" border-before-width.conditionality="retain" border-after-width.conditionality="retain" padding="3pt" text-align="from-table-column()" display-align="from-table-column()">
                        <fo:block>
						
                           <fo:block line-height="1pt">
                              <fo:external-graphic content-width="scale-to-fit" content-height="100%" width="100%" scaling="uniform" src="url(Images/moscow_0595-small.svg)"/>
                           </fo:block>
					
                        </fo:block>
                     </fo:table-cell>
					
                     <fo:table-cell border="0.25pt solid black" border-before-width.conditionality="retain" border-after-width.conditionality="retain" padding="3pt" text-align="from-table-column()" display-align="from-table-column()">
                        <fo:block>
						
                           <fo:block font-size="12pt" space-before="6pt" space-after="6pt" text-align="justify" text-indent="16pt" font-style="italic">Temperatures graphic [SVG].</fo:block>
						
                           <fo:block font-size="12pt" space-before="6pt" space-after="6pt" text-align="justify" text-indent="16pt">This image intrinsic width is 150 pixels and it's height is 150 pixels.</fo:block>
					
                        </fo:block>
                     </fo:table-cell>
				
                  </fo:table-row>
			
               </fo:table-body>
            </fo:table>
         </fo:table-and-caption>


      </fo:flow>
   </fo:page-sequence>
</fo:root>