| [f8c4e94] | 1 | <?xml version='1.0'?>
 | 
|---|
 | 2 | <!DOCTYPE xsl:stylesheet [
 | 
|---|
 | 3 | <!ENTITY lowercase "'abcdefghijklmnopqrstuvwxyz'">
 | 
|---|
 | 4 | <!ENTITY uppercase "'ABCDEFGHIJKLMNOPQRSTUVWXYZ'">
 | 
|---|
 | 5 |  ]>
 | 
|---|
 | 6 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 | 
|---|
 | 7 |                 xmlns:fo="http://www.w3.org/1999/XSL/Format"
 | 
|---|
 | 8 |                 xmlns:xlink="http://www.w3.org/1999/xlink"
 | 
|---|
 | 9 |                 xmlns:stext="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.TextFactory"
 | 
|---|
 | 10 |                 xmlns:xtext="com.nwalsh.xalan.Text"
 | 
|---|
 | 11 |                 xmlns:lxslt="http://xml.apache.org/xslt"
 | 
|---|
 | 12 |                 exclude-result-prefixes="xlink stext xtext lxslt"
 | 
|---|
 | 13 |                 extension-element-prefixes="stext xtext"
 | 
|---|
 | 14 |                 version='1.0'>
 | 
|---|
 | 15 | 
 | 
|---|
 | 16 | <!-- ********************************************************************
 | 
|---|
 | 17 |      $Id$
 | 
|---|
 | 18 |      ********************************************************************
 | 
|---|
 | 19 | 
 | 
|---|
 | 20 |      This file is part of the XSL DocBook Stylesheet distribution.
 | 
|---|
 | 21 |      See ../README or http://docbook.sf.net/release/xsl/current/ for
 | 
|---|
 | 22 |      copyright and other information.
 | 
|---|
 | 23 | 
 | 
|---|
 | 24 |      Contributors:
 | 
|---|
 | 25 |      Colin Paul Adams, <colin@colina.demon.co.uk>
 | 
|---|
 | 26 |      Paul Grosso, <pgrosso@arbortext.com>
 | 
|---|
 | 27 | 
 | 
|---|
 | 28 |      ******************************************************************** -->
 | 
|---|
 | 29 | 
 | 
|---|
 | 30 | <!-- ==================================================================== -->
 | 
|---|
 | 31 | <!-- Graphic format tests for the FO backend -->
 | 
|---|
 | 32 | 
 | 
|---|
 | 33 | <xsl:param name="graphic.notations">
 | 
|---|
 | 34 |   <!-- n.b. exactly one leading space, one trailing space, and one inter-word space -->
 | 
|---|
 | 35 |   <xsl:choose>
 | 
|---|
 | 36 |     <xsl:when test="$passivetex.extensions != 0">
 | 
|---|
 | 37 |       <xsl:text> PNG PDF JPG JPEG linespecific </xsl:text>
 | 
|---|
 | 38 |     </xsl:when>
 | 
|---|
 | 39 |     <xsl:when test="$fop1.extensions != 0">
 | 
|---|
 | 40 |       <xsl:text> BMP GIF TIFF SVG PNG EPS JPG JPEG linespecific </xsl:text>
 | 
|---|
 | 41 |     </xsl:when>
 | 
|---|
 | 42 |     <xsl:when test="$fop.extensions != 0">
 | 
|---|
 | 43 |       <xsl:text> BMP GIF TIFF SVG PNG EPS JPG JPEG linespecific </xsl:text>
 | 
|---|
 | 44 |     </xsl:when>
 | 
|---|
 | 45 |     <xsl:when test="$arbortext.extensions != 0">
 | 
|---|
 | 46 |       <xsl:text> PNG PDF JPG JPEG linespecific GIF GIF87a GIF89a TIFF BMP </xsl:text>
 | 
|---|
 | 47 |     </xsl:when>
 | 
|---|
 | 48 |     <xsl:when test="$xep.extensions != 0">
 | 
|---|
 | 49 |       <xsl:text> SVG PNG PDF JPG JPEG linespecific GIF GIF87a GIF89a TIFF BMP </xsl:text>
 | 
|---|
 | 50 |     </xsl:when>
 | 
|---|
 | 51 |     <xsl:otherwise>
 | 
|---|
 | 52 |       <xsl:text> PNG PDF JPG JPEG linespecific GIF GIF87a GIF89a TIFF BMP </xsl:text>
 | 
|---|
 | 53 |     </xsl:otherwise>
 | 
|---|
 | 54 |   </xsl:choose>
 | 
|---|
 | 55 | </xsl:param>
 | 
|---|
 | 56 | 
 | 
|---|
 | 57 | <xsl:template name="is.graphic.format">
 | 
|---|
 | 58 |   <xsl:param name="format"/>
 | 
|---|
 | 59 |   <xsl:if test="contains($graphic.notations, concat(' ',$format,' '))">1</xsl:if>
 | 
|---|
 | 60 | </xsl:template>
 | 
|---|
 | 61 | 
 | 
|---|
 | 62 | <xsl:param name="graphic.extensions">
 | 
|---|
 | 63 |   <!-- n.b. exactly one leading space, one trailing space, and one inter-word space -->
 | 
|---|
 | 64 |   <xsl:choose>
 | 
|---|
 | 65 |     <xsl:when test="$passivetex.extensions != 0">
 | 
|---|
 | 66 |       <xsl:text> png pdf jpg jpeg </xsl:text>
 | 
|---|
 | 67 |     </xsl:when>
 | 
|---|
 | 68 |     <xsl:when test="$fop1.extensions != 0">
 | 
|---|
 | 69 |       <xsl:text> bmp gif tif tiff svg png pdf jpg jpeg eps </xsl:text>
 | 
|---|
 | 70 |     </xsl:when>
 | 
|---|
 | 71 |     <xsl:when test="$fop.extensions != 0">
 | 
|---|
 | 72 |       <xsl:text> bmp gif tif tiff svg png pdf jpg jpeg eps </xsl:text>
 | 
|---|
 | 73 |     </xsl:when>
 | 
|---|
 | 74 |     <xsl:when test="$arbortext.extensions != 0">
 | 
|---|
 | 75 |       <xsl:text> png pdf jpg jpeg gif tif tiff bmp </xsl:text>
 | 
|---|
 | 76 |     </xsl:when>
 | 
|---|
 | 77 |     <xsl:when test="$xep.extensions != 0">
 | 
|---|
 | 78 |       <xsl:text> svg png pdf jpg jpeg gif tif tiff bmp eps </xsl:text>
 | 
|---|
 | 79 |     </xsl:when>
 | 
|---|
 | 80 |     <xsl:otherwise>
 | 
|---|
 | 81 |       <xsl:text> svg png pdf jpg jpeg gif tif tiff bmp eps </xsl:text>
 | 
|---|
 | 82 |     </xsl:otherwise>
 | 
|---|
 | 83 |   </xsl:choose>
 | 
|---|
 | 84 | </xsl:param>
 | 
|---|
 | 85 | 
 | 
|---|
 | 86 | <xsl:template name="is.graphic.extension">
 | 
|---|
 | 87 |   <xsl:param name="ext"/>
 | 
|---|
 | 88 |   <xsl:variable name="lcext" select="translate($ext,
 | 
|---|
 | 89 |                                        'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
 | 
|---|
 | 90 |                                        'abcdefghijklmnopqrstuvwxyz')"/>
 | 
|---|
 | 91 | 
 | 
|---|
 | 92 |   <xsl:if test="contains($graphic.extensions,
 | 
|---|
 | 93 |                          concat(' ', $lcext, ' '))">1</xsl:if>
 | 
|---|
 | 94 | </xsl:template>
 | 
|---|
 | 95 | 
 | 
|---|
 | 96 | <xsl:template name="graphic.format.content-type">
 | 
|---|
 | 97 |   <xsl:param name="format"/>
 | 
|---|
 | 98 |   <xsl:variable name="is.graphic.format">
 | 
|---|
 | 99 |     <xsl:call-template name="is.graphic.format">
 | 
|---|
 | 100 |       <xsl:with-param name="format" select="$format"/>
 | 
|---|
 | 101 |     </xsl:call-template>
 | 
|---|
 | 102 |   </xsl:variable>
 | 
|---|
 | 103 |   <xsl:if test="$is.graphic.format">
 | 
|---|
 | 104 |     <xsl:choose>
 | 
|---|
 | 105 |       <xsl:when test="$format = ''"></xsl:when>
 | 
|---|
 | 106 |       <xsl:when test="$format = 'linespecific'"></xsl:when>
 | 
|---|
 | 107 |       <xsl:when test="$format = 'PS'">application/postscript</xsl:when>
 | 
|---|
 | 108 |       <xsl:when test="$format = 'PDF'">application/pdf</xsl:when>
 | 
|---|
 | 109 |       <xsl:when test="$format = 'PNG'">image/png</xsl:when>
 | 
|---|
 | 110 |       <xsl:when test="$format = 'SVG'">image/svg+xml</xsl:when>
 | 
|---|
 | 111 |       <xsl:when test="$format = 'JPG'">image/jpeg</xsl:when>
 | 
|---|
 | 112 |       <xsl:when test="$format = 'GIF87a'">image/gif</xsl:when>
 | 
|---|
 | 113 |       <xsl:when test="$format = 'GIF89a'">image/gif</xsl:when>
 | 
|---|
 | 114 |       <xsl:otherwise>
 | 
|---|
 | 115 |           <xsl:value-of select="concat('image/', 
 | 
|---|
 | 116 |             translate($format, &uppercase;, &lowercase;))"/>
 | 
|---|
 | 117 |       </xsl:otherwise>
 | 
|---|
 | 118 |     </xsl:choose>
 | 
|---|
 | 119 |   </xsl:if>
 | 
|---|
 | 120 | </xsl:template>
 | 
|---|
 | 121 | 
 | 
|---|
 | 122 | 
 | 
|---|
 | 123 | <!-- ==================================================================== -->
 | 
|---|
 | 124 | 
 | 
|---|
 | 125 | <xsl:template match="screenshot">
 | 
|---|
 | 126 |   <fo:block>
 | 
|---|
 | 127 |     <xsl:apply-templates/>
 | 
|---|
 | 128 |   </fo:block>
 | 
|---|
 | 129 | </xsl:template>
 | 
|---|
 | 130 | 
 | 
|---|
 | 131 | <xsl:template match="screeninfo">
 | 
|---|
 | 132 | </xsl:template>
 | 
|---|
 | 133 | 
 | 
|---|
 | 134 | <!-- ==================================================================== -->
 | 
|---|
 | 135 | <!-- Override these templates for FO -->
 | 
|---|
 | 136 | <!-- ==================================================================== -->
 | 
|---|
 | 137 | 
 | 
|---|
 | 138 | <xsl:template name="process.image">
 | 
|---|
 | 139 |   <!-- When this template is called, the current node should be  -->
 | 
|---|
 | 140 |   <!-- a graphic, inlinegraphic, imagedata, or videodata. All    -->
 | 
|---|
 | 141 |   <!-- those elements have the same set of attributes, so we can -->
 | 
|---|
 | 142 |   <!-- handle them all in one place.                             -->
 | 
|---|
 | 143 | 
 | 
|---|
 | 144 |   <xsl:variable name="scalefit">
 | 
|---|
 | 145 |     <xsl:choose>
 | 
|---|
 | 146 |       <xsl:when test="$ignore.image.scaling != 0">0</xsl:when>
 | 
|---|
 | 147 |       <xsl:when test="@contentwidth">0</xsl:when>
 | 
|---|
 | 148 |       <xsl:when test="@contentdepth and 
 | 
|---|
 | 149 |                       @contentdepth != '100%'">0</xsl:when>
 | 
|---|
 | 150 |       <xsl:when test="@scale">0</xsl:when>
 | 
|---|
 | 151 |       <xsl:when test="@scalefit"><xsl:value-of select="@scalefit"/></xsl:when>
 | 
|---|
 | 152 |       <xsl:when test="@width or @depth">1</xsl:when>
 | 
|---|
 | 153 |       <xsl:otherwise>0</xsl:otherwise>
 | 
|---|
 | 154 |     </xsl:choose>
 | 
|---|
 | 155 |   </xsl:variable>
 | 
|---|
 | 156 | 
 | 
|---|
 | 157 |   <xsl:variable name="scale">
 | 
|---|
 | 158 |     <xsl:choose>
 | 
|---|
 | 159 |       <xsl:when test="$ignore.image.scaling != 0">0</xsl:when>
 | 
|---|
 | 160 |       <xsl:when test="@contentwidth or @contentdepth">1.0</xsl:when>
 | 
|---|
 | 161 |       <xsl:when test="@scale">
 | 
|---|
 | 162 |         <xsl:value-of select="@scale div 100.0"/>
 | 
|---|
 | 163 |       </xsl:when>
 | 
|---|
 | 164 |       <xsl:otherwise>1.0</xsl:otherwise>
 | 
|---|
 | 165 |     </xsl:choose>
 | 
|---|
 | 166 |   </xsl:variable>
 | 
|---|
 | 167 | 
 | 
|---|
 | 168 |   <xsl:variable name="filename">
 | 
|---|
 | 169 |     <xsl:choose>
 | 
|---|
 | 170 |       <xsl:when test="local-name(.) = 'graphic'
 | 
|---|
 | 171 |                       or local-name(.) = 'inlinegraphic'">
 | 
|---|
 | 172 |         <!-- handle legacy graphic and inlinegraphic by new template --> 
 | 
|---|
 | 173 |         <xsl:call-template name="mediaobject.filename">
 | 
|---|
 | 174 |           <xsl:with-param name="object" select="."/>
 | 
|---|
 | 175 |         </xsl:call-template>
 | 
|---|
 | 176 |       </xsl:when>
 | 
|---|
 | 177 |       <xsl:otherwise>
 | 
|---|
 | 178 |         <!-- imagedata, videodata, audiodata -->
 | 
|---|
 | 179 |         <xsl:call-template name="mediaobject.filename">
 | 
|---|
 | 180 |           <xsl:with-param name="object" select=".."/>
 | 
|---|
 | 181 |         </xsl:call-template>
 | 
|---|
 | 182 |       </xsl:otherwise>
 | 
|---|
 | 183 |     </xsl:choose>
 | 
|---|
 | 184 |   </xsl:variable>
 | 
|---|
 | 185 | 
 | 
|---|
 | 186 |   <xsl:variable name="content-type">
 | 
|---|
 | 187 |     <xsl:if test="@format">
 | 
|---|
 | 188 |       <xsl:call-template name="graphic.format.content-type">
 | 
|---|
 | 189 |         <xsl:with-param name="format" select="@format"/>
 | 
|---|
 | 190 |       </xsl:call-template>
 | 
|---|
 | 191 |     </xsl:if>
 | 
|---|
 | 192 |   </xsl:variable>
 | 
|---|
 | 193 | 
 | 
|---|
 | 194 |   <xsl:variable name="bgcolor">
 | 
|---|
 | 195 |     <xsl:call-template name="pi.dbfo_background-color">
 | 
|---|
 | 196 |       <xsl:with-param name="node" select=".."/>
 | 
|---|
 | 197 |     </xsl:call-template>
 | 
|---|
 | 198 |   </xsl:variable>
 | 
|---|
 | 199 | 
 | 
|---|
 | 200 |   <fo:external-graphic>
 | 
|---|
 | 201 |     <xsl:attribute name="src">
 | 
|---|
 | 202 |       <xsl:call-template name="fo-external-image">
 | 
|---|
 | 203 |         <xsl:with-param name="filename">
 | 
|---|
 | 204 |           <xsl:if test="$img.src.path != '' and
 | 
|---|
 | 205 |                         not(starts-with($filename, '/')) and
 | 
|---|
 | 206 |                         not(contains($filename, '://'))">
 | 
|---|
 | 207 |             <xsl:value-of select="$img.src.path"/>
 | 
|---|
 | 208 |           </xsl:if>
 | 
|---|
 | 209 |           <xsl:value-of select="$filename"/>
 | 
|---|
 | 210 |         </xsl:with-param>
 | 
|---|
 | 211 |       </xsl:call-template>
 | 
|---|
 | 212 |     </xsl:attribute>
 | 
|---|
 | 213 | 
 | 
|---|
 | 214 |     <xsl:attribute name="width">
 | 
|---|
 | 215 |       <xsl:choose>
 | 
|---|
 | 216 |         <xsl:when test="$ignore.image.scaling != 0">auto</xsl:when>
 | 
|---|
 | 217 |         <xsl:when test="contains(@width,'%')">
 | 
|---|
 | 218 |           <xsl:value-of select="@width"/>
 | 
|---|
 | 219 |         </xsl:when>
 | 
|---|
 | 220 |         <xsl:when test="@width and not(@width = '')">
 | 
|---|
 | 221 |           <xsl:call-template name="length-spec">
 | 
|---|
 | 222 |             <xsl:with-param name="length" select="@width"/>
 | 
|---|
 | 223 |             <xsl:with-param name="default.units" select="'px'"/>
 | 
|---|
 | 224 |           </xsl:call-template>
 | 
|---|
 | 225 |         </xsl:when>
 | 
|---|
 | 226 |         <xsl:when test="not(@depth) and $default.image.width != ''">
 | 
|---|
 | 227 |           <xsl:call-template name="length-spec">
 | 
|---|
 | 228 |             <xsl:with-param name="length" select="$default.image.width"/>
 | 
|---|
 | 229 |             <xsl:with-param name="default.units" select="'px'"/>
 | 
|---|
 | 230 |           </xsl:call-template>
 | 
|---|
 | 231 |         </xsl:when>
 | 
|---|
 | 232 |         <xsl:otherwise>auto</xsl:otherwise>
 | 
|---|
 | 233 |       </xsl:choose>
 | 
|---|
 | 234 |     </xsl:attribute>
 | 
|---|
 | 235 | 
 | 
|---|
 | 236 |     <xsl:attribute name="height">
 | 
|---|
 | 237 |       <xsl:choose>
 | 
|---|
 | 238 |         <xsl:when test="$ignore.image.scaling != 0">auto</xsl:when>
 | 
|---|
 | 239 |         <xsl:when test="contains(@depth,'%')">
 | 
|---|
 | 240 |           <xsl:value-of select="@depth"/>
 | 
|---|
 | 241 |         </xsl:when>
 | 
|---|
 | 242 |         <xsl:when test="@depth">
 | 
|---|
 | 243 |           <xsl:call-template name="length-spec">
 | 
|---|
 | 244 |             <xsl:with-param name="length" select="@depth"/>
 | 
|---|
 | 245 |             <xsl:with-param name="default.units" select="'px'"/>
 | 
|---|
 | 246 |           </xsl:call-template>
 | 
|---|
 | 247 |         </xsl:when>
 | 
|---|
 | 248 |         <xsl:otherwise>auto</xsl:otherwise>
 | 
|---|
 | 249 |       </xsl:choose>
 | 
|---|
 | 250 |     </xsl:attribute>
 | 
|---|
 | 251 | 
 | 
|---|
 | 252 |     <xsl:attribute name="content-width">
 | 
|---|
 | 253 |       <xsl:choose>
 | 
|---|
 | 254 |         <xsl:when test="$ignore.image.scaling != 0">auto</xsl:when>
 | 
|---|
 | 255 |         <xsl:when test="contains(@contentwidth,'%')">
 | 
|---|
 | 256 |           <xsl:value-of select="@contentwidth"/>
 | 
|---|
 | 257 |         </xsl:when>
 | 
|---|
 | 258 |         <xsl:when test="@contentwidth">
 | 
|---|
 | 259 |           <xsl:call-template name="length-spec">
 | 
|---|
 | 260 |             <xsl:with-param name="length" select="@contentwidth"/>
 | 
|---|
 | 261 |             <xsl:with-param name="default.units" select="'px'"/>
 | 
|---|
 | 262 |           </xsl:call-template>
 | 
|---|
 | 263 |         </xsl:when>
 | 
|---|
 | 264 |         <xsl:when test="number($scale) != 1.0">
 | 
|---|
 | 265 |           <xsl:value-of select="$scale * 100"/>
 | 
|---|
 | 266 |           <xsl:text>%</xsl:text>
 | 
|---|
 | 267 |         </xsl:when>
 | 
|---|
 | 268 |         <xsl:when test="$scalefit = 1">scale-to-fit</xsl:when>
 | 
|---|
 | 269 |         <xsl:otherwise>auto</xsl:otherwise>
 | 
|---|
 | 270 |       </xsl:choose>
 | 
|---|
 | 271 |     </xsl:attribute>
 | 
|---|
 | 272 | 
 | 
|---|
 | 273 |     <xsl:attribute name="content-height">
 | 
|---|
 | 274 |       <xsl:choose>
 | 
|---|
 | 275 |         <xsl:when test="$ignore.image.scaling != 0">auto</xsl:when>
 | 
|---|
 | 276 |         <xsl:when test="contains(@contentdepth,'%')">
 | 
|---|
 | 277 |           <xsl:value-of select="@contentdepth"/>
 | 
|---|
 | 278 |         </xsl:when>
 | 
|---|
 | 279 |         <xsl:when test="@contentdepth">
 | 
|---|
 | 280 |           <xsl:call-template name="length-spec">
 | 
|---|
 | 281 |             <xsl:with-param name="length" select="@contentdepth"/>
 | 
|---|
 | 282 |             <xsl:with-param name="default.units" select="'px'"/>
 | 
|---|
 | 283 |           </xsl:call-template>
 | 
|---|
 | 284 |         </xsl:when>
 | 
|---|
 | 285 |         <xsl:when test="number($scale) != 1.0">
 | 
|---|
 | 286 |           <xsl:value-of select="$scale * 100"/>
 | 
|---|
 | 287 |           <xsl:text>%</xsl:text>
 | 
|---|
 | 288 |         </xsl:when>
 | 
|---|
 | 289 |         <xsl:when test="$scalefit = 1">scale-to-fit</xsl:when>
 | 
|---|
 | 290 |         <xsl:otherwise>auto</xsl:otherwise>
 | 
|---|
 | 291 |       </xsl:choose>
 | 
|---|
 | 292 |     </xsl:attribute>
 | 
|---|
 | 293 | 
 | 
|---|
 | 294 |     <xsl:if test="$content-type != ''">
 | 
|---|
 | 295 |       <xsl:attribute name="content-type">
 | 
|---|
 | 296 |         <xsl:value-of select="concat('content-type:',$content-type)"/>
 | 
|---|
 | 297 |       </xsl:attribute>
 | 
|---|
 | 298 |     </xsl:if>
 | 
|---|
 | 299 | 
 | 
|---|
 | 300 |     <xsl:if test="$bgcolor != ''">
 | 
|---|
 | 301 |       <xsl:attribute name="background-color">
 | 
|---|
 | 302 |         <xsl:value-of select="$bgcolor"/>
 | 
|---|
 | 303 |       </xsl:attribute>
 | 
|---|
 | 304 |     </xsl:if>
 | 
|---|
 | 305 | 
 | 
|---|
 | 306 |     <xsl:if test="@align">
 | 
|---|
 | 307 |       <xsl:attribute name="text-align">
 | 
|---|
 | 308 |         <xsl:value-of select="@align"/>
 | 
|---|
 | 309 |       </xsl:attribute>
 | 
|---|
 | 310 |     </xsl:if>
 | 
|---|
 | 311 | 
 | 
|---|
 | 312 |     <xsl:if test="@valign">
 | 
|---|
 | 313 |       <xsl:attribute name="display-align">
 | 
|---|
 | 314 |         <xsl:choose>
 | 
|---|
 | 315 |           <xsl:when test="@valign = 'top'">before</xsl:when>
 | 
|---|
 | 316 |           <xsl:when test="@valign = 'middle'">center</xsl:when>
 | 
|---|
 | 317 |           <xsl:when test="@valign = 'bottom'">after</xsl:when>
 | 
|---|
 | 318 |           <xsl:otherwise>auto</xsl:otherwise>
 | 
|---|
 | 319 |         </xsl:choose>
 | 
|---|
 | 320 |       </xsl:attribute>
 | 
|---|
 | 321 |     </xsl:if>
 | 
|---|
 | 322 |   </fo:external-graphic>
 | 
|---|
 | 323 | </xsl:template>
 | 
|---|
 | 324 | 
 | 
|---|
 | 325 | <!-- ==================================================================== -->
 | 
|---|
 | 326 | 
 | 
|---|
 | 327 | <xsl:template match="graphic">
 | 
|---|
 | 328 |   <xsl:choose>
 | 
|---|
 | 329 |     <xsl:when test="parent::inlineequation">
 | 
|---|
 | 330 |       <xsl:call-template name="process.image"/>
 | 
|---|
 | 331 |     </xsl:when>
 | 
|---|
 | 332 |     <xsl:otherwise>
 | 
|---|
 | 333 |       <fo:block>
 | 
|---|
 | 334 |         <xsl:if test="@align">
 | 
|---|
 | 335 |           <xsl:attribute name="text-align">
 | 
|---|
 | 336 |             <xsl:value-of select="@align"/>
 | 
|---|
 | 337 |           </xsl:attribute>
 | 
|---|
 | 338 |         </xsl:if>
 | 
|---|
 | 339 |         <xsl:call-template name="process.image"/>
 | 
|---|
 | 340 |       </fo:block>
 | 
|---|
 | 341 |     </xsl:otherwise>
 | 
|---|
 | 342 |   </xsl:choose>
 | 
|---|
 | 343 | </xsl:template>
 | 
|---|
 | 344 | 
 | 
|---|
 | 345 | <xsl:template match="inlinegraphic">
 | 
|---|
 | 346 |   <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
 | 
|---|
 | 347 |   <xsl:variable name="filename">
 | 
|---|
 | 348 |     <xsl:choose>
 | 
|---|
 | 349 |       <xsl:when test="@entityref">
 | 
|---|
 | 350 |         <xsl:value-of select="unparsed-entity-uri(@entityref)"/>
 | 
|---|
 | 351 |       </xsl:when>
 | 
|---|
 | 352 |       <xsl:otherwise>
 | 
|---|
 | 353 |         <xsl:apply-templates select="@fileref"/>
 | 
|---|
 | 354 |       </xsl:otherwise>
 | 
|---|
 | 355 |     </xsl:choose>
 | 
|---|
 | 356 |   </xsl:variable>
 | 
|---|
 | 357 | 
 | 
|---|
 | 358 |   <xsl:choose>
 | 
|---|
 | 359 |     <xsl:when test="@format='linespecific'">
 | 
|---|
 | 360 |       <xsl:choose>
 | 
|---|
 | 361 |         <xsl:when test="$use.extensions != '0'
 | 
|---|
 | 362 |                         and $textinsert.extension != '0'">
 | 
|---|
 | 363 |           <xsl:choose>
 | 
|---|
 | 364 |             <xsl:when test="contains($vendor, 'SAXON')">
 | 
|---|
 | 365 |               <stext:insertfile href="{$filename}" encoding="{$textdata.default.encoding}"/>
 | 
|---|
 | 366 |             </xsl:when>
 | 
|---|
 | 367 |             <xsl:when test="contains($vendor, 'Apache Software Foundation')">
 | 
|---|
 | 368 |               <xtext:insertfile href="{$filename}"/>
 | 
|---|
 | 369 |             </xsl:when>
 | 
|---|
 | 370 |             <xsl:otherwise>
 | 
|---|
 | 371 |               <xsl:message terminate="yes">
 | 
|---|
 | 372 |                 <xsl:text>Don't know how to insert files with </xsl:text>
 | 
|---|
 | 373 |                 <xsl:value-of select="$vendor"/>
 | 
|---|
 | 374 |               </xsl:message>
 | 
|---|
 | 375 |             </xsl:otherwise>
 | 
|---|
 | 376 |           </xsl:choose>
 | 
|---|
 | 377 |         </xsl:when>
 | 
|---|
| [d7c9f58] | 378 |         <xsl:otherwise>
 | 
|---|
 | 379 |           <xsl:message terminate="yes">
 | 
|---|
 | 380 |             <xsl:text>Cannot insert </xsl:text><xsl:value-of select="$filename"/>
 | 
|---|
 | 381 |             <xsl:text>. Check use.extensions and textinsert.extension parameters.</xsl:text> 
 | 
|---|
 | 382 |           </xsl:message>
 | 
|---|
| [f8c4e94] | 383 |         </xsl:otherwise>
 | 
|---|
 | 384 |       </xsl:choose>
 | 
|---|
 | 385 |     </xsl:when>
 | 
|---|
 | 386 |     <xsl:otherwise>
 | 
|---|
 | 387 |       <xsl:call-template name="process.image"/>
 | 
|---|
 | 388 |     </xsl:otherwise>
 | 
|---|
 | 389 |   </xsl:choose>
 | 
|---|
 | 390 | </xsl:template>
 | 
|---|
 | 391 | 
 | 
|---|
 | 392 | <!-- ==================================================================== -->
 | 
|---|
 | 393 | 
 | 
|---|
 | 394 | <xsl:template match="mediaobject|mediaobjectco">
 | 
|---|
 | 395 | 
 | 
|---|
 | 396 |   <xsl:variable name="olist" select="imageobject|imageobjectco
 | 
|---|
 | 397 |                      |videoobject|audioobject
 | 
|---|
 | 398 |                      |textobject"/>
 | 
|---|
 | 399 | 
 | 
|---|
 | 400 |   <xsl:variable name="object.index">
 | 
|---|
 | 401 |     <xsl:call-template name="select.mediaobject.index">
 | 
|---|
 | 402 |       <xsl:with-param name="olist" select="$olist"/>
 | 
|---|
 | 403 |       <xsl:with-param name="count" select="1"/>
 | 
|---|
 | 404 |     </xsl:call-template>
 | 
|---|
 | 405 |   </xsl:variable>
 | 
|---|
 | 406 | 
 | 
|---|
 | 407 |   <xsl:variable name="object" select="$olist[position() = $object.index]"/>
 | 
|---|
 | 408 | 
 | 
|---|
 | 409 |   <xsl:variable name="align">
 | 
|---|
 | 410 |     <xsl:value-of select="$object/descendant::imagedata[@align][1]/@align"/>
 | 
|---|
 | 411 |   </xsl:variable>
 | 
|---|
 | 412 | 
 | 
|---|
 | 413 |   <xsl:variable name="id">
 | 
|---|
 | 414 |     <xsl:call-template name="object.id"/>
 | 
|---|
 | 415 |   </xsl:variable>
 | 
|---|
 | 416 | 
 | 
|---|
 | 417 |   <fo:block id="{$id}">
 | 
|---|
 | 418 |     <xsl:if test="$align != '' ">
 | 
|---|
 | 419 |       <xsl:attribute name="text-align">
 | 
|---|
 | 420 |         <xsl:value-of select="$align"/>
 | 
|---|
 | 421 |       </xsl:attribute>
 | 
|---|
 | 422 |     </xsl:if>
 | 
|---|
 | 423 | 
 | 
|---|
 | 424 |     <xsl:apply-templates select="$object"/>
 | 
|---|
 | 425 |     <xsl:apply-templates select="caption"/>
 | 
|---|
 | 426 |   </fo:block>
 | 
|---|
 | 427 | </xsl:template>
 | 
|---|
 | 428 | 
 | 
|---|
 | 429 | <xsl:template match="inlinemediaobject">
 | 
|---|
 | 430 |   <xsl:call-template name="select.mediaobject"/>
 | 
|---|
 | 431 | </xsl:template>
 | 
|---|
 | 432 | 
 | 
|---|
 | 433 | <!-- ==================================================================== -->
 | 
|---|
 | 434 | 
 | 
|---|
 | 435 | <xsl:template match="imageobjectco">
 | 
|---|
 | 436 |   <xsl:apply-templates select="imageobject"/>
 | 
|---|
 | 437 |   <xsl:apply-templates select="calloutlist"/>
 | 
|---|
 | 438 | </xsl:template>
 | 
|---|
 | 439 | 
 | 
|---|
 | 440 | <xsl:template match="imageobject">
 | 
|---|
 | 441 |   <xsl:choose>
 | 
|---|
 | 442 |     <xsl:when test="imagedata">
 | 
|---|
 | 443 |       <xsl:apply-templates select="imagedata"/>
 | 
|---|
 | 444 |     </xsl:when>
 | 
|---|
 | 445 |     <xsl:otherwise>
 | 
|---|
 | 446 |       <fo:instream-foreign-object>
 | 
|---|
 | 447 |         <xsl:apply-templates mode="copy-all"/>
 | 
|---|
 | 448 |       </fo:instream-foreign-object>
 | 
|---|
 | 449 |     </xsl:otherwise>
 | 
|---|
 | 450 |   </xsl:choose>
 | 
|---|
 | 451 | </xsl:template>
 | 
|---|
 | 452 | 
 | 
|---|
 | 453 | <!-- ==================================================================== -->
 | 
|---|
 | 454 | 
 | 
|---|
 | 455 | <xsl:template match="*" mode="copy-all">
 | 
|---|
 | 456 |   <xsl:copy>
 | 
|---|
 | 457 |     <xsl:for-each select="@*">
 | 
|---|
 | 458 |       <xsl:copy/>
 | 
|---|
 | 459 |     </xsl:for-each>
 | 
|---|
 | 460 |     <xsl:apply-templates mode="copy-all"/>
 | 
|---|
 | 461 |   </xsl:copy>
 | 
|---|
 | 462 | </xsl:template>
 | 
|---|
 | 463 | 
 | 
|---|
 | 464 | <xsl:template match="text()|comment()|processing-instruction()" mode="copy-all">
 | 
|---|
 | 465 |   <xsl:copy/>
 | 
|---|
 | 466 | </xsl:template>
 | 
|---|
 | 467 | 
 | 
|---|
 | 468 | <!-- ==================================================================== -->
 | 
|---|
 | 469 | 
 | 
|---|
 | 470 | <xsl:template match="imagedata">
 | 
|---|
 | 471 |   <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
 | 
|---|
 | 472 |   <xsl:variable name="filename">
 | 
|---|
 | 473 |     <xsl:call-template name="mediaobject.filename">
 | 
|---|
 | 474 |       <xsl:with-param name="object" select=".."/>
 | 
|---|
 | 475 |     </xsl:call-template>
 | 
|---|
 | 476 |   </xsl:variable>
 | 
|---|
 | 477 | 
 | 
|---|
 | 478 |   <xsl:choose>
 | 
|---|
 | 479 |     <xsl:when test="@format='linespecific'">
 | 
|---|
 | 480 |       <xsl:choose>
 | 
|---|
 | 481 |         <xsl:when test="$use.extensions != '0'
 | 
|---|
 | 482 |                         and $textinsert.extension != '0'">
 | 
|---|
 | 483 |           <xsl:choose>
 | 
|---|
 | 484 |             <xsl:when test="contains($vendor, 'SAXON')">
 | 
|---|
 | 485 |               <stext:insertfile href="{$filename}" encoding="{$textdata.default.encoding}"/>
 | 
|---|
 | 486 |             </xsl:when>
 | 
|---|
 | 487 |             <xsl:when test="contains($vendor, 'Apache Software Foundation')">
 | 
|---|
 | 488 |               <xtext:insertfile href="{$filename}"/>
 | 
|---|
 | 489 |             </xsl:when>
 | 
|---|
 | 490 |             <xsl:otherwise>
 | 
|---|
 | 491 |               <xsl:message terminate="yes">
 | 
|---|
 | 492 |                 <xsl:text>Don't know how to insert files with </xsl:text>
 | 
|---|
 | 493 |                 <xsl:value-of select="$vendor"/>
 | 
|---|
 | 494 |               </xsl:message>
 | 
|---|
 | 495 |             </xsl:otherwise>
 | 
|---|
 | 496 |           </xsl:choose>
 | 
|---|
 | 497 |         </xsl:when>
 | 
|---|
 | 498 |         <xsl:otherwise>
 | 
|---|
| [d7c9f58] | 499 |           <xsl:message terminate="yes">
 | 
|---|
 | 500 |             <xsl:text>Cannot insert </xsl:text><xsl:value-of select="$filename"/>
 | 
|---|
 | 501 |             <xsl:text>. Check use.extensions and textinsert.extension parameters.</xsl:text> 
 | 
|---|
 | 502 |           </xsl:message>
 | 
|---|
 | 503 |         </xsl:otherwise>
 | 
|---|
| [f8c4e94] | 504 |       </xsl:choose>
 | 
|---|
 | 505 |     </xsl:when>
 | 
|---|
 | 506 |     <xsl:otherwise>
 | 
|---|
 | 507 |       <xsl:call-template name="process.image"/>
 | 
|---|
 | 508 |     </xsl:otherwise>
 | 
|---|
 | 509 |   </xsl:choose>
 | 
|---|
 | 510 | </xsl:template>
 | 
|---|
 | 511 | 
 | 
|---|
 | 512 | <!-- ==================================================================== -->
 | 
|---|
 | 513 | 
 | 
|---|
 | 514 | <xsl:template match="videoobject">
 | 
|---|
 | 515 |   <xsl:apply-templates select="videodata"/>
 | 
|---|
 | 516 | </xsl:template>
 | 
|---|
 | 517 | 
 | 
|---|
 | 518 | <xsl:template match="videodata">
 | 
|---|
 | 519 |   <xsl:call-template name="process.image"/>
 | 
|---|
 | 520 | </xsl:template>
 | 
|---|
 | 521 | 
 | 
|---|
 | 522 | <!-- ==================================================================== -->
 | 
|---|
 | 523 | 
 | 
|---|
 | 524 | <xsl:template match="audioobject">
 | 
|---|
 | 525 |   <xsl:apply-templates select="audiodata"/>
 | 
|---|
 | 526 | </xsl:template>
 | 
|---|
 | 527 | 
 | 
|---|
 | 528 | <xsl:template match="audiodata">
 | 
|---|
 | 529 |   <xsl:call-template name="process.image"/>
 | 
|---|
 | 530 | </xsl:template>
 | 
|---|
 | 531 | 
 | 
|---|
 | 532 | <!-- ==================================================================== -->
 | 
|---|
 | 533 | 
 | 
|---|
 | 534 | <xsl:template match="textobject">
 | 
|---|
 | 535 |   <xsl:apply-templates/>
 | 
|---|
 | 536 | </xsl:template>
 | 
|---|
 | 537 | 
 | 
|---|
 | 538 | <xsl:template match="textdata">
 | 
|---|
| [d7c9f58] | 539 |   <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
 | 
|---|
| [f8c4e94] | 540 |   <xsl:variable name="filename">
 | 
|---|
 | 541 |     <xsl:choose>
 | 
|---|
 | 542 |       <xsl:when test="@entityref">
 | 
|---|
 | 543 |         <xsl:value-of select="unparsed-entity-uri(@entityref)"/>
 | 
|---|
 | 544 |       </xsl:when>
 | 
|---|
 | 545 |       <xsl:otherwise>
 | 
|---|
 | 546 |         <xsl:apply-templates select="@fileref"/>
 | 
|---|
 | 547 |       </xsl:otherwise>
 | 
|---|
 | 548 |     </xsl:choose>
 | 
|---|
 | 549 |   </xsl:variable>
 | 
|---|
 | 550 | 
 | 
|---|
 | 551 |   <xsl:variable name="encoding">
 | 
|---|
 | 552 |     <xsl:choose>
 | 
|---|
 | 553 |       <xsl:when test="@encoding">
 | 
|---|
 | 554 |         <xsl:value-of select="@encoding"/>
 | 
|---|
 | 555 |       </xsl:when>
 | 
|---|
 | 556 |       <xsl:otherwise>
 | 
|---|
 | 557 |         <xsl:value-of select="$textdata.default.encoding"/>
 | 
|---|
 | 558 |       </xsl:otherwise>
 | 
|---|
 | 559 |     </xsl:choose>
 | 
|---|
 | 560 |   </xsl:variable>
 | 
|---|
 | 561 | 
 | 
|---|
 | 562 |   <xsl:choose>
 | 
|---|
 | 563 |     <xsl:when test="$use.extensions != '0'
 | 
|---|
 | 564 |                     and $textinsert.extension != '0'">
 | 
|---|
 | 565 |       <xsl:choose>
 | 
|---|
 | 566 |         <xsl:when test="element-available('stext:insertfile')">
 | 
|---|
 | 567 |           <stext:insertfile href="{$filename}" encoding="{$encoding}"/>
 | 
|---|
 | 568 |         </xsl:when>
 | 
|---|
 | 569 |         <xsl:when test="element-available('xtext:insertfile')">
 | 
|---|
 | 570 |           <xtext:insertfile href="{$filename}"/>
 | 
|---|
 | 571 |         </xsl:when>
 | 
|---|
| [d7c9f58] | 572 |         <xsl:otherwise>
 | 
|---|
 | 573 |           <xsl:message terminate="yes">
 | 
|---|
 | 574 |             <xsl:text>Don't know how to insert files with </xsl:text>
 | 
|---|
 | 575 |             <xsl:value-of select="$vendor"/>
 | 
|---|
 | 576 |           </xsl:message>
 | 
|---|
 | 577 |         </xsl:otherwise>
 | 
|---|
| [f8c4e94] | 578 |       </xsl:choose>
 | 
|---|
 | 579 |     </xsl:when>
 | 
|---|
 | 580 |     <xsl:otherwise>
 | 
|---|
| [d7c9f58] | 581 |       <xsl:message terminate="yes">
 | 
|---|
 | 582 |         <xsl:text>Cannot insert </xsl:text><xsl:value-of select="$filename"/>
 | 
|---|
 | 583 |         <xsl:text>. Check use.extensions and textinsert.extension parameters.</xsl:text> 
 | 
|---|
 | 584 |       </xsl:message>
 | 
|---|
| [f8c4e94] | 585 |     </xsl:otherwise>
 | 
|---|
 | 586 |   </xsl:choose>
 | 
|---|
 | 587 | </xsl:template>
 | 
|---|
 | 588 | 
 | 
|---|
 | 589 | <!-- ==================================================================== -->
 | 
|---|
 | 590 | 
 | 
|---|
 | 591 | <xsl:template match="caption">
 | 
|---|
 | 592 |   <fo:block>
 | 
|---|
 | 593 |     <xsl:if test="@align = 'right' or @align = 'left' or @align='center'">
 | 
|---|
 | 594 |       <xsl:attribute name="text-align"><xsl:value-of
 | 
|---|
 | 595 |                          select="@align"/></xsl:attribute>
 | 
|---|
 | 596 |     </xsl:if>
 | 
|---|
 | 597 |     <xsl:apply-templates/>
 | 
|---|
 | 598 |   </fo:block>
 | 
|---|
 | 599 | </xsl:template>
 | 
|---|
 | 600 | 
 | 
|---|
 | 601 | <!-- ==================================================================== -->
 | 
|---|
 | 602 | 
 | 
|---|
 | 603 | <xsl:template name="fo-external-image">
 | 
|---|
 | 604 |   <xsl:param name="filename"/>
 | 
|---|
 | 605 | 
 | 
|---|
 | 606 |   <xsl:choose>
 | 
|---|
 | 607 |     <xsl:when test="$passivetex.extensions != 0
 | 
|---|
 | 608 |                     or $fop.extensions != 0">
 | 
|---|
 | 609 |       <xsl:value-of select="$filename"/>
 | 
|---|
 | 610 |     </xsl:when>
 | 
|---|
 | 611 |     <xsl:otherwise>
 | 
|---|
 | 612 |       <xsl:value-of select="concat('url(', $filename, ')')"/>
 | 
|---|
 | 613 |     </xsl:otherwise>
 | 
|---|
 | 614 |   </xsl:choose>
 | 
|---|
 | 615 | </xsl:template>
 | 
|---|
 | 616 | 
 | 
|---|
 | 617 | <!-- Resolve xml:base attributes -->
 | 
|---|
 | 618 | <xsl:template match="@fileref">
 | 
|---|
 | 619 |   <!-- need a check for absolute urls -->
 | 
|---|
 | 620 |   <xsl:choose>
 | 
|---|
 | 621 |     <xsl:when test="contains(., ':') or starts-with(.,'/')">
 | 
|---|
 | 622 |       <!-- it has a uri scheme or starts with '/', so it is an absolute uri -->
 | 
|---|
 | 623 |       <xsl:value-of select="."/>
 | 
|---|
 | 624 |     </xsl:when>
 | 
|---|
 | 625 |     <xsl:when test="$keep.relative.image.uris != 0">
 | 
|---|
 | 626 |       <!-- leave it alone -->
 | 
|---|
 | 627 |       <xsl:value-of select="."/>
 | 
|---|
 | 628 |     </xsl:when>
 | 
|---|
 | 629 |     <xsl:otherwise>
 | 
|---|
 | 630 |       <!-- its a relative uri -->
 | 
|---|
 | 631 |       <xsl:call-template name="relative-uri">
 | 
|---|
 | 632 |       </xsl:call-template>
 | 
|---|
 | 633 |     </xsl:otherwise>
 | 
|---|
 | 634 |   </xsl:choose>
 | 
|---|
 | 635 | </xsl:template>
 | 
|---|
 | 636 | 
 | 
|---|
 | 637 | </xsl:stylesheet>
 | 
|---|