[9882b55] | 1 | <?xml version="1.0" encoding="ASCII"?>
|
---|
| 2 | <!--This file was created automatically by html2xhtml-->
|
---|
| 3 | <!--from the HTML stylesheets.-->
|
---|
| 4 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:stext="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.TextFactory" xmlns:simg="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.ImageIntrinsics" xmlns:ximg="xalan://com.nwalsh.xalan.ImageIntrinsics" xmlns:xtext="xalan://com.nwalsh.xalan.Text" xmlns:lxslt="http://xml.apache.org/xslt" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="xlink stext xtext lxslt simg ximg" extension-element-prefixes="stext xtext" version="1.0">
|
---|
| 5 |
|
---|
| 6 | <!-- ********************************************************************
|
---|
| 7 | $Id$
|
---|
| 8 | ********************************************************************
|
---|
| 9 |
|
---|
| 10 | This file is part of the XSL DocBook Stylesheet distribution.
|
---|
| 11 | See ../README or http://docbook.sf.net/release/xsl/current/ for
|
---|
| 12 | copyright and other information.
|
---|
| 13 |
|
---|
| 14 | Contributors:
|
---|
| 15 | Colin Paul Adams, <colin@colina.demon.co.uk>
|
---|
| 16 |
|
---|
| 17 | ******************************************************************** -->
|
---|
| 18 |
|
---|
| 19 | <lxslt:component prefix="xtext" elements="insertfile"/>
|
---|
| 20 | <lxslt:component prefix="ximg" functions="new getWidth getDepth"/>
|
---|
| 21 |
|
---|
| 22 | <!-- ==================================================================== -->
|
---|
| 23 | <!-- Graphic format tests for the HTML backend -->
|
---|
| 24 |
|
---|
| 25 | <xsl:template name="is.graphic.format">
|
---|
| 26 | <xsl:param name="format"/>
|
---|
| 27 | <xsl:if test="$format = 'SVG' or $format = 'PNG' or $format = 'JPG' or $format = 'JPEG' or $format = 'linespecific' or $format = 'GIF' or $format = 'GIF87a' or $format = 'GIF89a' or $format = 'BMP'">1</xsl:if>
|
---|
| 28 | </xsl:template>
|
---|
| 29 |
|
---|
| 30 | <xsl:template name="is.graphic.extension">
|
---|
| 31 | <xsl:param name="ext"/>
|
---|
| 32 | <xsl:variable name="lcext" select="translate($ext, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/>
|
---|
| 33 | <xsl:if test="$lcext = 'svg' or $lcext = 'png' or $lcext = 'jpeg' or $lcext = 'jpg' or $lcext = 'avi' or $lcext = 'mpg' or $lcext = 'mpeg' or $lcext = 'qt' or $lcext = 'gif' or $lcext = 'bmp'">1</xsl:if>
|
---|
| 34 | </xsl:template>
|
---|
| 35 |
|
---|
| 36 | <!-- ==================================================================== -->
|
---|
| 37 |
|
---|
| 38 | <xsl:template match="screenshot">
|
---|
| 39 | <div>
|
---|
| 40 | <xsl:apply-templates select="." mode="class.attribute"/>
|
---|
| 41 | <xsl:apply-templates/>
|
---|
| 42 | </div>
|
---|
| 43 | </xsl:template>
|
---|
| 44 |
|
---|
| 45 | <xsl:template match="screeninfo">
|
---|
| 46 | </xsl:template>
|
---|
| 47 |
|
---|
| 48 | <!-- ==================================================================== -->
|
---|
| 49 |
|
---|
| 50 | <xsl:template name="process.image">
|
---|
| 51 | <!-- When this template is called, the current node should be -->
|
---|
| 52 | <!-- a graphic, inlinegraphic, imagedata, or videodata. All -->
|
---|
| 53 | <!-- those elements have the same set of attributes, so we can -->
|
---|
| 54 | <!-- handle them all in one place. -->
|
---|
| 55 | <xsl:param name="tag" select="'img'"/>
|
---|
| 56 | <xsl:param name="alt"/>
|
---|
| 57 | <xsl:param name="longdesc"/>
|
---|
| 58 |
|
---|
| 59 | <!-- The HTML img element only supports the notion of content-area
|
---|
| 60 | scaling; it doesn't support the distinction between a
|
---|
| 61 | content-area and a viewport-area, so we have to make some
|
---|
| 62 | compromises.
|
---|
| 63 |
|
---|
| 64 | 1. If only the content-area is specified, everything is fine.
|
---|
| 65 | (If you ask for a three inch image, that's what you'll get.)
|
---|
| 66 |
|
---|
| 67 | 2. If only the viewport-area is provided:
|
---|
| 68 | - If scalefit=1, treat it as both the content-area and
|
---|
| 69 | the viewport-area. (If you ask for an image in a five inch
|
---|
| 70 | area, we'll make the image five inches to fill that area.)
|
---|
| 71 | - If scalefit=0, ignore the viewport-area specification.
|
---|
| 72 |
|
---|
| 73 | Note: this is not quite the right semantic and has the additional
|
---|
| 74 | problem that it can result in anamorphic scaling, which scalefit
|
---|
| 75 | should never cause.
|
---|
| 76 |
|
---|
| 77 | 3. If both the content-area and the viewport-area is specified
|
---|
| 78 | on a graphic element, ignore the viewport-area.
|
---|
| 79 | (If you ask for a three inch image in a five inch area, we'll assume
|
---|
| 80 | it's better to give you a three inch image in an unspecified area
|
---|
| 81 | than a five inch image in a five inch area.
|
---|
| 82 |
|
---|
| 83 | Relative units also cause problems. As a general rule, the stylesheets
|
---|
| 84 | are operating too early and too loosely coupled with the rendering engine
|
---|
| 85 | to know things like the current font size or the actual dimensions of
|
---|
| 86 | an image. Therefore:
|
---|
| 87 |
|
---|
| 88 | 1. We use a fixed size for pixels, $pixels.per.inch
|
---|
| 89 |
|
---|
| 90 | 2. We use a fixed size for "em"s, $points.per.em
|
---|
| 91 |
|
---|
| 92 | Percentages are problematic. In the following discussion, we speak
|
---|
| 93 | of width and contentwidth, but the same issues apply to depth and
|
---|
| 94 | contentdepth
|
---|
| 95 |
|
---|
| 96 | 1. A width of 50% means "half of the available space for the image."
|
---|
| 97 | That's fine. But note that in HTML, this is a dynamic property and
|
---|
| 98 | the image size will vary if the browser window is resized.
|
---|
| 99 |
|
---|
| 100 | 2. A contentwidth of 50% means "half of the actual image width". But
|
---|
| 101 | the stylesheets have no way to assess the image's actual size. Treating
|
---|
| 102 | this as a width of 50% is one possibility, but it produces behavior
|
---|
| 103 | (dynamic scaling) that seems entirely out of character with the
|
---|
| 104 | meaning.
|
---|
| 105 |
|
---|
| 106 | Instead, the stylesheets define a $nominal.image.width
|
---|
| 107 | and convert percentages to actual values based on that nominal size.
|
---|
| 108 |
|
---|
| 109 | Scale can be problematic. Scale applies to the contentwidth, so
|
---|
| 110 | a scale of 50 when a contentwidth is not specified is analagous to a
|
---|
| 111 | width of 50%. (If a contentwidth is specified, the scaling factor can
|
---|
| 112 | be applied to that value and no problem exists.)
|
---|
| 113 |
|
---|
| 114 | If scale is specified but contentwidth is not supplied, the
|
---|
| 115 | nominal.image.width is used to calculate a base size
|
---|
| 116 | for scaling.
|
---|
| 117 |
|
---|
| 118 | Warning: as a consequence of these decisions, unless the aspect ratio
|
---|
| 119 | of your image happens to be exactly the same as (nominal width / nominal height),
|
---|
| 120 | specifying contentwidth="50%" and contentdepth="50%" is NOT going to
|
---|
| 121 | scale the way you expect (or really, the way it should).
|
---|
| 122 |
|
---|
| 123 | Don't do that. In fact, a percentage value is not recommended for content
|
---|
| 124 | size at all. Use scale instead.
|
---|
| 125 |
|
---|
| 126 | Finally, align and valign are troublesome. Horizontal alignment is now
|
---|
| 127 | supported by wrapping the image in a <div align="{@align}"> (in block
|
---|
| 128 | contexts!). I can't think of anything (practical) to do about vertical
|
---|
| 129 | alignment.
|
---|
| 130 | -->
|
---|
| 131 |
|
---|
| 132 | <xsl:variable name="width-units">
|
---|
| 133 | <xsl:choose>
|
---|
| 134 | <xsl:when test="$ignore.image.scaling != 0"/>
|
---|
| 135 | <xsl:when test="@width">
|
---|
| 136 | <xsl:call-template name="length-units">
|
---|
| 137 | <xsl:with-param name="length" select="@width"/>
|
---|
| 138 | </xsl:call-template>
|
---|
| 139 | </xsl:when>
|
---|
| 140 | <xsl:when test="not(@depth) and $default.image.width != ''">
|
---|
| 141 | <xsl:call-template name="length-units">
|
---|
| 142 | <xsl:with-param name="length" select="$default.image.width"/>
|
---|
| 143 | </xsl:call-template>
|
---|
| 144 | </xsl:when>
|
---|
| 145 | </xsl:choose>
|
---|
| 146 | </xsl:variable>
|
---|
| 147 |
|
---|
| 148 | <xsl:variable name="width">
|
---|
| 149 | <xsl:choose>
|
---|
| 150 | <xsl:when test="$ignore.image.scaling != 0"/>
|
---|
| 151 | <xsl:when test="@width">
|
---|
| 152 | <xsl:choose>
|
---|
| 153 | <xsl:when test="$width-units = '%'">
|
---|
| 154 | <xsl:value-of select="@width"/>
|
---|
| 155 | </xsl:when>
|
---|
| 156 | <xsl:otherwise>
|
---|
| 157 | <xsl:call-template name="length-spec">
|
---|
| 158 | <xsl:with-param name="length" select="@width"/>
|
---|
| 159 | </xsl:call-template>
|
---|
| 160 | </xsl:otherwise>
|
---|
| 161 | </xsl:choose>
|
---|
| 162 | </xsl:when>
|
---|
| 163 | <xsl:when test="not(@depth) and $default.image.width != ''">
|
---|
| 164 | <xsl:value-of select="$default.image.width"/>
|
---|
| 165 | </xsl:when>
|
---|
| 166 | </xsl:choose>
|
---|
| 167 | </xsl:variable>
|
---|
| 168 |
|
---|
| 169 | <xsl:variable name="scalefit">
|
---|
| 170 | <xsl:choose>
|
---|
| 171 | <xsl:when test="$ignore.image.scaling != 0">0</xsl:when>
|
---|
| 172 | <xsl:when test="@contentwidth or @contentdepth">0</xsl:when>
|
---|
| 173 | <xsl:when test="@scale">0</xsl:when>
|
---|
| 174 | <xsl:when test="@scalefit"><xsl:value-of select="@scalefit"/></xsl:when>
|
---|
| 175 | <xsl:when test="$width != '' or @depth">1</xsl:when>
|
---|
| 176 | <xsl:otherwise>0</xsl:otherwise>
|
---|
| 177 | </xsl:choose>
|
---|
| 178 | </xsl:variable>
|
---|
| 179 |
|
---|
| 180 | <xsl:variable name="scale">
|
---|
| 181 | <xsl:choose>
|
---|
| 182 | <xsl:when test="$ignore.image.scaling != 0">1.0</xsl:when>
|
---|
| 183 | <xsl:when test="@contentwidth or @contentdepth">1.0</xsl:when>
|
---|
| 184 | <xsl:when test="@scale">
|
---|
| 185 | <xsl:value-of select="@scale div 100.0"/>
|
---|
| 186 | </xsl:when>
|
---|
| 187 | <xsl:otherwise>1.0</xsl:otherwise>
|
---|
| 188 | </xsl:choose>
|
---|
| 189 | </xsl:variable>
|
---|
| 190 |
|
---|
| 191 | <xsl:variable name="filename">
|
---|
| 192 | <xsl:choose>
|
---|
| 193 | <xsl:when test="local-name(.) = 'graphic' or local-name(.) = 'inlinegraphic'">
|
---|
| 194 | <!-- handle legacy graphic and inlinegraphic by new template -->
|
---|
| 195 | <xsl:call-template name="mediaobject.filename">
|
---|
| 196 | <xsl:with-param name="object" select="."/>
|
---|
| 197 | </xsl:call-template>
|
---|
| 198 | </xsl:when>
|
---|
| 199 | <xsl:otherwise>
|
---|
| 200 | <!-- imagedata, videodata, audiodata -->
|
---|
| 201 | <xsl:call-template name="mediaobject.filename">
|
---|
| 202 | <xsl:with-param name="object" select=".."/>
|
---|
| 203 | </xsl:call-template>
|
---|
| 204 | </xsl:otherwise>
|
---|
| 205 | </xsl:choose>
|
---|
| 206 | </xsl:variable>
|
---|
| 207 |
|
---|
| 208 | <xsl:variable name="output_filename">
|
---|
| 209 | <xsl:choose>
|
---|
| 210 | <xsl:when test="@entityref">
|
---|
| 211 | <xsl:value-of select="$filename"/>
|
---|
| 212 | </xsl:when>
|
---|
| 213 | <!--
|
---|
| 214 | Moved test for $keep.relative.image.uris to template below:
|
---|
| 215 | <xsl:template match="@fileref">
|
---|
| 216 | -->
|
---|
| 217 | <xsl:otherwise>
|
---|
| 218 | <xsl:value-of select="$filename"/>
|
---|
| 219 | </xsl:otherwise>
|
---|
| 220 | </xsl:choose>
|
---|
| 221 | </xsl:variable>
|
---|
| 222 |
|
---|
| 223 | <xsl:variable name="img.src.path.pi">
|
---|
| 224 | <xsl:call-template name="dbhtml-attribute">
|
---|
| 225 | <xsl:with-param name="pis" select="../processing-instruction('dbhtml')"/>
|
---|
| 226 | <xsl:with-param name="attribute" select="'img.src.path'"/>
|
---|
| 227 | </xsl:call-template>
|
---|
| 228 | </xsl:variable>
|
---|
| 229 |
|
---|
| 230 | <xsl:variable name="filename.for.graphicsize">
|
---|
| 231 | <xsl:choose>
|
---|
| 232 | <xsl:when test="$img.src.path.pi != ''">
|
---|
| 233 | <xsl:value-of select="concat($img.src.path.pi, $filename)"/>
|
---|
| 234 | </xsl:when>
|
---|
| 235 | <xsl:when test="$img.src.path != '' and $graphicsize.use.img.src.path != 0 and $tag = 'img' and not(starts-with($filename, '/')) and not(contains($filename, '://'))">
|
---|
| 236 | <xsl:value-of select="concat($img.src.path, $filename)"/>
|
---|
| 237 | </xsl:when>
|
---|
| 238 | <xsl:otherwise>
|
---|
| 239 | <xsl:value-of select="$filename"/>
|
---|
| 240 | </xsl:otherwise>
|
---|
| 241 | </xsl:choose>
|
---|
| 242 | </xsl:variable>
|
---|
| 243 |
|
---|
| 244 | <xsl:variable name="realintrinsicwidth">
|
---|
| 245 | <!-- This funny compound test works around a bug in XSLTC -->
|
---|
| 246 | <xsl:choose>
|
---|
| 247 | <xsl:when test="$use.extensions != 0 and $graphicsize.extension != 0">
|
---|
| 248 | <xsl:choose>
|
---|
| 249 | <xsl:when test="function-available('simg:getWidth')">
|
---|
| 250 | <xsl:value-of select="simg:getWidth(simg:new($filename.for.graphicsize), $nominal.image.width)"/>
|
---|
| 251 | </xsl:when>
|
---|
| 252 | <xsl:when test="function-available('ximg:getWidth')">
|
---|
| 253 | <xsl:value-of select="ximg:getWidth(ximg:new($filename.for.graphicsize), $nominal.image.width)"/>
|
---|
| 254 | </xsl:when>
|
---|
| 255 | <xsl:otherwise>
|
---|
| 256 | <xsl:value-of select="0"/>
|
---|
| 257 | </xsl:otherwise>
|
---|
| 258 | </xsl:choose>
|
---|
| 259 | </xsl:when>
|
---|
| 260 | <xsl:otherwise>
|
---|
| 261 | <xsl:value-of select="0"/>
|
---|
| 262 | </xsl:otherwise>
|
---|
| 263 | </xsl:choose>
|
---|
| 264 | </xsl:variable>
|
---|
| 265 |
|
---|
| 266 | <xsl:variable name="intrinsicwidth">
|
---|
| 267 | <xsl:choose>
|
---|
| 268 | <xsl:when test="$realintrinsicwidth = 0">
|
---|
| 269 | <xsl:value-of select="$nominal.image.width"/>
|
---|
| 270 | </xsl:when>
|
---|
| 271 | <xsl:otherwise>
|
---|
| 272 | <xsl:value-of select="$realintrinsicwidth"/>
|
---|
| 273 | </xsl:otherwise>
|
---|
| 274 | </xsl:choose>
|
---|
| 275 | </xsl:variable>
|
---|
| 276 |
|
---|
| 277 | <xsl:variable name="intrinsicdepth">
|
---|
| 278 | <!-- This funny compound test works around a bug in XSLTC -->
|
---|
| 279 | <xsl:choose>
|
---|
| 280 | <xsl:when test="$use.extensions != 0 and $graphicsize.extension != 0">
|
---|
| 281 | <xsl:choose>
|
---|
| 282 | <xsl:when test="function-available('simg:getDepth')">
|
---|
| 283 | <xsl:value-of select="simg:getDepth(simg:new($filename.for.graphicsize), $nominal.image.depth)"/>
|
---|
| 284 | </xsl:when>
|
---|
| 285 | <xsl:when test="function-available('ximg:getDepth')">
|
---|
| 286 | <xsl:value-of select="ximg:getDepth(ximg:new($filename.for.graphicsize), $nominal.image.depth)"/>
|
---|
| 287 | </xsl:when>
|
---|
| 288 | <xsl:otherwise>
|
---|
| 289 | <xsl:value-of select="$nominal.image.depth"/>
|
---|
| 290 | </xsl:otherwise>
|
---|
| 291 | </xsl:choose>
|
---|
| 292 | </xsl:when>
|
---|
| 293 | <xsl:otherwise>
|
---|
| 294 | <xsl:value-of select="$nominal.image.depth"/>
|
---|
| 295 | </xsl:otherwise>
|
---|
| 296 | </xsl:choose>
|
---|
| 297 | </xsl:variable>
|
---|
| 298 |
|
---|
| 299 | <xsl:variable name="contentwidth">
|
---|
| 300 | <xsl:choose>
|
---|
| 301 | <xsl:when test="$ignore.image.scaling != 0"/>
|
---|
| 302 | <xsl:when test="@contentwidth">
|
---|
| 303 | <xsl:variable name="units">
|
---|
| 304 | <xsl:call-template name="length-units">
|
---|
| 305 | <xsl:with-param name="length" select="@contentwidth"/>
|
---|
| 306 | </xsl:call-template>
|
---|
| 307 | </xsl:variable>
|
---|
| 308 |
|
---|
| 309 | <xsl:choose>
|
---|
| 310 | <xsl:when test="$units = '%'">
|
---|
| 311 | <xsl:variable name="cmagnitude">
|
---|
| 312 | <xsl:call-template name="length-magnitude">
|
---|
| 313 | <xsl:with-param name="length" select="@contentwidth"/>
|
---|
| 314 | </xsl:call-template>
|
---|
| 315 | </xsl:variable>
|
---|
| 316 | <xsl:value-of select="$intrinsicwidth * $cmagnitude div 100.0"/>
|
---|
| 317 | <xsl:text>px</xsl:text>
|
---|
| 318 | </xsl:when>
|
---|
| 319 | <xsl:otherwise>
|
---|
| 320 | <xsl:call-template name="length-spec">
|
---|
| 321 | <xsl:with-param name="length" select="@contentwidth"/>
|
---|
| 322 | </xsl:call-template>
|
---|
| 323 | </xsl:otherwise>
|
---|
| 324 | </xsl:choose>
|
---|
| 325 | </xsl:when>
|
---|
| 326 | <xsl:otherwise>
|
---|
| 327 | <xsl:value-of select="$intrinsicwidth"/>
|
---|
| 328 | <xsl:text>px</xsl:text>
|
---|
| 329 | </xsl:otherwise>
|
---|
| 330 | </xsl:choose>
|
---|
| 331 | </xsl:variable>
|
---|
| 332 |
|
---|
| 333 | <xsl:variable name="scaled.contentwidth">
|
---|
| 334 | <xsl:if test="$contentwidth != ''">
|
---|
| 335 | <xsl:variable name="cwidth.in.points">
|
---|
| 336 | <xsl:call-template name="length-in-points">
|
---|
| 337 | <xsl:with-param name="length" select="$contentwidth"/>
|
---|
| 338 | <xsl:with-param name="pixels.per.inch" select="$pixels.per.inch"/>
|
---|
| 339 | <xsl:with-param name="em.size" select="$points.per.em"/>
|
---|
| 340 | </xsl:call-template>
|
---|
| 341 | </xsl:variable>
|
---|
| 342 | <xsl:value-of select="$cwidth.in.points div 72.0 * $pixels.per.inch * $scale"/>
|
---|
| 343 | </xsl:if>
|
---|
| 344 | </xsl:variable>
|
---|
| 345 |
|
---|
| 346 | <xsl:variable name="html.width">
|
---|
| 347 | <xsl:choose>
|
---|
| 348 | <xsl:when test="$ignore.image.scaling != 0"/>
|
---|
| 349 | <xsl:when test="$width-units = '%'">
|
---|
| 350 | <xsl:value-of select="$width"/>
|
---|
| 351 | </xsl:when>
|
---|
| 352 | <xsl:when test="$width != ''">
|
---|
| 353 | <xsl:variable name="width.in.points">
|
---|
| 354 | <xsl:call-template name="length-in-points">
|
---|
| 355 | <xsl:with-param name="length" select="$width"/>
|
---|
| 356 | <xsl:with-param name="pixels.per.inch" select="$pixels.per.inch"/>
|
---|
| 357 | <xsl:with-param name="em.size" select="$points.per.em"/>
|
---|
| 358 | </xsl:call-template>
|
---|
| 359 | </xsl:variable>
|
---|
| 360 | <xsl:value-of select="round($width.in.points div 72.0 * $pixels.per.inch)"/>
|
---|
| 361 | </xsl:when>
|
---|
| 362 | <xsl:otherwise/>
|
---|
| 363 | </xsl:choose>
|
---|
| 364 | </xsl:variable>
|
---|
| 365 |
|
---|
| 366 | <xsl:variable name="contentdepth">
|
---|
| 367 | <xsl:choose>
|
---|
| 368 | <xsl:when test="$ignore.image.scaling != 0"/>
|
---|
| 369 | <xsl:when test="@contentdepth">
|
---|
| 370 | <xsl:variable name="units">
|
---|
| 371 | <xsl:call-template name="length-units">
|
---|
| 372 | <xsl:with-param name="length" select="@contentdepth"/>
|
---|
| 373 | </xsl:call-template>
|
---|
| 374 | </xsl:variable>
|
---|
| 375 |
|
---|
| 376 | <xsl:choose>
|
---|
| 377 | <xsl:when test="$units = '%'">
|
---|
| 378 | <xsl:variable name="cmagnitude">
|
---|
| 379 | <xsl:call-template name="length-magnitude">
|
---|
| 380 | <xsl:with-param name="length" select="@contentdepth"/>
|
---|
| 381 | </xsl:call-template>
|
---|
| 382 | </xsl:variable>
|
---|
| 383 | <xsl:value-of select="$intrinsicdepth * $cmagnitude div 100.0"/>
|
---|
| 384 | <xsl:text>px</xsl:text>
|
---|
| 385 | </xsl:when>
|
---|
| 386 | <xsl:otherwise>
|
---|
| 387 | <xsl:call-template name="length-spec">
|
---|
| 388 | <xsl:with-param name="length" select="@contentdepth"/>
|
---|
| 389 | </xsl:call-template>
|
---|
| 390 | </xsl:otherwise>
|
---|
| 391 | </xsl:choose>
|
---|
| 392 | </xsl:when>
|
---|
| 393 | <xsl:otherwise>
|
---|
| 394 | <xsl:value-of select="$intrinsicdepth"/>
|
---|
| 395 | <xsl:text>px</xsl:text>
|
---|
| 396 | </xsl:otherwise>
|
---|
| 397 | </xsl:choose>
|
---|
| 398 | </xsl:variable>
|
---|
| 399 |
|
---|
| 400 | <xsl:variable name="scaled.contentdepth">
|
---|
| 401 | <xsl:if test="$contentdepth != ''">
|
---|
| 402 | <xsl:variable name="cdepth.in.points">
|
---|
| 403 | <xsl:call-template name="length-in-points">
|
---|
| 404 | <xsl:with-param name="length" select="$contentdepth"/>
|
---|
| 405 | <xsl:with-param name="pixels.per.inch" select="$pixels.per.inch"/>
|
---|
| 406 | <xsl:with-param name="em.size" select="$points.per.em"/>
|
---|
| 407 | </xsl:call-template>
|
---|
| 408 | </xsl:variable>
|
---|
| 409 | <xsl:value-of select="$cdepth.in.points div 72.0 * $pixels.per.inch * $scale"/>
|
---|
| 410 | </xsl:if>
|
---|
| 411 | </xsl:variable>
|
---|
| 412 |
|
---|
| 413 | <xsl:variable name="depth-units">
|
---|
| 414 | <xsl:if test="@depth">
|
---|
| 415 | <xsl:call-template name="length-units">
|
---|
| 416 | <xsl:with-param name="length" select="@depth"/>
|
---|
| 417 | </xsl:call-template>
|
---|
| 418 | </xsl:if>
|
---|
| 419 | </xsl:variable>
|
---|
| 420 |
|
---|
| 421 | <xsl:variable name="depth">
|
---|
| 422 | <xsl:if test="@depth">
|
---|
| 423 | <xsl:choose>
|
---|
| 424 | <xsl:when test="$depth-units = '%'">
|
---|
| 425 | <xsl:value-of select="@depth"/>
|
---|
| 426 | </xsl:when>
|
---|
| 427 | <xsl:otherwise>
|
---|
| 428 | <xsl:call-template name="length-spec">
|
---|
| 429 | <xsl:with-param name="length" select="@depth"/>
|
---|
| 430 | </xsl:call-template>
|
---|
| 431 | </xsl:otherwise>
|
---|
| 432 | </xsl:choose>
|
---|
| 433 | </xsl:if>
|
---|
| 434 | </xsl:variable>
|
---|
| 435 |
|
---|
| 436 | <xsl:variable name="html.depth">
|
---|
| 437 | <xsl:choose>
|
---|
| 438 | <xsl:when test="$ignore.image.scaling != 0"/>
|
---|
| 439 | <xsl:when test="$depth-units = '%'">
|
---|
| 440 | <xsl:value-of select="$depth"/>
|
---|
| 441 | </xsl:when>
|
---|
| 442 | <xsl:when test="@depth and @depth != ''">
|
---|
| 443 | <xsl:variable name="depth.in.points">
|
---|
| 444 | <xsl:call-template name="length-in-points">
|
---|
| 445 | <xsl:with-param name="length" select="$depth"/>
|
---|
| 446 | <xsl:with-param name="pixels.per.inch" select="$pixels.per.inch"/>
|
---|
| 447 | <xsl:with-param name="em.size" select="$points.per.em"/>
|
---|
| 448 | </xsl:call-template>
|
---|
| 449 | </xsl:variable>
|
---|
| 450 | <xsl:value-of select="round($depth.in.points div 72.0 * $pixels.per.inch)"/>
|
---|
| 451 | </xsl:when>
|
---|
| 452 | <xsl:otherwise/>
|
---|
| 453 | </xsl:choose>
|
---|
| 454 | </xsl:variable>
|
---|
| 455 |
|
---|
| 456 | <xsl:variable name="viewport">
|
---|
| 457 | <xsl:choose>
|
---|
| 458 | <xsl:when test="$ignore.image.scaling != 0">0</xsl:when>
|
---|
| 459 | <xsl:when test="local-name(.) = 'inlinegraphic' or ancestor::inlinemediaobject or ancestor::inlineequation">0</xsl:when>
|
---|
| 460 | <xsl:otherwise>
|
---|
| 461 | <xsl:value-of select="$make.graphic.viewport"/>
|
---|
| 462 | </xsl:otherwise>
|
---|
| 463 | </xsl:choose>
|
---|
| 464 | </xsl:variable>
|
---|
| 465 |
|
---|
| 466 | <!--
|
---|
| 467 | <xsl:message>=====================================
|
---|
| 468 | scale: <xsl:value-of select="$scale"/>, <xsl:value-of select="$scalefit"/>
|
---|
| 469 | @contentwidth <xsl:value-of select="@contentwidth"/>
|
---|
| 470 | $contentwidth <xsl:value-of select="$contentwidth"/>
|
---|
| 471 | scaled.contentwidth: <xsl:value-of select="$scaled.contentwidth"/>
|
---|
| 472 | @width: <xsl:value-of select="@width"/>
|
---|
| 473 | width: <xsl:value-of select="$width"/>
|
---|
| 474 | html.width: <xsl:value-of select="$html.width"/>
|
---|
| 475 | @contentdepth <xsl:value-of select="@contentdepth"/>
|
---|
| 476 | $contentdepth <xsl:value-of select="$contentdepth"/>
|
---|
| 477 | scaled.contentdepth: <xsl:value-of select="$scaled.contentdepth"/>
|
---|
| 478 | @depth: <xsl:value-of select="@depth"/>
|
---|
| 479 | depth: <xsl:value-of select="$depth"/>
|
---|
| 480 | html.depth: <xsl:value-of select="$html.depth"/>
|
---|
| 481 | align: <xsl:value-of select="@align"/>
|
---|
| 482 | valign: <xsl:value-of select="@valign"/></xsl:message>
|
---|
| 483 | -->
|
---|
| 484 |
|
---|
| 485 | <xsl:variable name="scaled" select="@width|@depth|@contentwidth|@contentdepth |@scale|@scalefit"/>
|
---|
| 486 |
|
---|
| 487 | <xsl:variable name="img">
|
---|
| 488 | <xsl:choose>
|
---|
| 489 | <xsl:when test="@format = 'SVG'">
|
---|
| 490 | <object data="{$output_filename}" type="image/svg+xml">
|
---|
| 491 | <xsl:call-template name="process.image.attributes">
|
---|
| 492 | <!--xsl:with-param name="alt" select="$alt"/ there's no alt here-->
|
---|
| 493 | <xsl:with-param name="html.depth" select="$html.depth"/>
|
---|
| 494 | <xsl:with-param name="html.width" select="$html.width"/>
|
---|
| 495 | <xsl:with-param name="longdesc" select="$longdesc"/>
|
---|
| 496 | <xsl:with-param name="scale" select="$scale"/>
|
---|
| 497 | <xsl:with-param name="scalefit" select="$scalefit"/>
|
---|
| 498 | <xsl:with-param name="scaled.contentdepth" select="$scaled.contentdepth"/>
|
---|
| 499 | <xsl:with-param name="scaled.contentwidth" select="$scaled.contentwidth"/>
|
---|
| 500 | <xsl:with-param name="viewport" select="$viewport"/>
|
---|
| 501 | </xsl:call-template>
|
---|
| 502 | <xsl:if test="@align">
|
---|
| 503 | <xsl:attribute name="align">
|
---|
| 504 | <xsl:choose>
|
---|
| 505 | <xsl:when test="@align = 'center'">middle</xsl:when>
|
---|
| 506 | <xsl:otherwise>
|
---|
| 507 | <xsl:value-of select="@align"/>
|
---|
| 508 | </xsl:otherwise>
|
---|
| 509 | </xsl:choose>
|
---|
| 510 | </xsl:attribute>
|
---|
| 511 | </xsl:if>
|
---|
| 512 | <xsl:if test="$use.embed.for.svg != 0">
|
---|
| 513 | <embed src="{$output_filename}" type="image/svg+xml">
|
---|
| 514 | <xsl:call-template name="process.image.attributes">
|
---|
| 515 | <!--xsl:with-param name="alt" select="$alt"/ there's no alt here -->
|
---|
| 516 | <xsl:with-param name="html.depth" select="$html.depth"/>
|
---|
| 517 | <xsl:with-param name="html.width" select="$html.width"/>
|
---|
| 518 | <xsl:with-param name="longdesc" select="$longdesc"/>
|
---|
| 519 | <xsl:with-param name="scale" select="$scale"/>
|
---|
| 520 | <xsl:with-param name="scalefit" select="$scalefit"/>
|
---|
| 521 | <xsl:with-param name="scaled.contentdepth" select="$scaled.contentdepth"/>
|
---|
| 522 | <xsl:with-param name="scaled.contentwidth" select="$scaled.contentwidth"/>
|
---|
| 523 | <xsl:with-param name="viewport" select="$viewport"/>
|
---|
| 524 | </xsl:call-template>
|
---|
| 525 | </embed>
|
---|
| 526 | </xsl:if>
|
---|
| 527 | </object>
|
---|
| 528 | </xsl:when>
|
---|
| 529 | <xsl:otherwise>
|
---|
| 530 | <xsl:element name="{$tag}" namespace="http://www.w3.org/1999/xhtml">
|
---|
| 531 | <xsl:if test="$tag = 'img' and ../../self::imageobjectco">
|
---|
| 532 | <xsl:variable name="mapname">
|
---|
| 533 | <xsl:call-template name="object.id">
|
---|
| 534 | <xsl:with-param name="object" select="../../areaspec"/>
|
---|
| 535 | </xsl:call-template>
|
---|
| 536 | </xsl:variable>
|
---|
| 537 | <xsl:choose>
|
---|
| 538 | <xsl:when test="$scaled">
|
---|
| 539 | <!-- It might be possible to handle some scaling; needs -->
|
---|
| 540 | <!-- more investigation -->
|
---|
| 541 | <xsl:message>
|
---|
| 542 | <xsl:text>Warning: imagemaps not supported </xsl:text>
|
---|
| 543 | <xsl:text>on scaled images</xsl:text>
|
---|
| 544 | </xsl:message>
|
---|
| 545 | </xsl:when>
|
---|
| 546 | <xsl:otherwise>
|
---|
| 547 | <xsl:attribute name="border">0</xsl:attribute>
|
---|
| 548 | <xsl:attribute name="usemap">
|
---|
| 549 | <xsl:value-of select="concat('#', $mapname)"/>
|
---|
| 550 | </xsl:attribute>
|
---|
| 551 | </xsl:otherwise>
|
---|
| 552 | </xsl:choose>
|
---|
| 553 | </xsl:if>
|
---|
| 554 |
|
---|
| 555 | <xsl:attribute name="src">
|
---|
| 556 | <xsl:choose>
|
---|
| 557 | <xsl:when test="$img.src.path != '' and $tag = 'img' and not(starts-with($output_filename, '/')) and not(contains($output_filename, '://'))">
|
---|
| 558 | <xsl:value-of select="$img.src.path"/>
|
---|
| 559 | </xsl:when>
|
---|
| 560 | </xsl:choose>
|
---|
| 561 | <xsl:value-of select="$output_filename"/>
|
---|
| 562 | </xsl:attribute>
|
---|
| 563 |
|
---|
| 564 | <xsl:if test="@align">
|
---|
| 565 | <xsl:attribute name="align">
|
---|
| 566 | <xsl:choose>
|
---|
| 567 | <xsl:when test="@align = 'center'">middle</xsl:when>
|
---|
| 568 | <xsl:otherwise>
|
---|
| 569 | <xsl:value-of select="@align"/>
|
---|
| 570 | </xsl:otherwise>
|
---|
| 571 | </xsl:choose>
|
---|
| 572 | </xsl:attribute>
|
---|
| 573 | </xsl:if>
|
---|
| 574 |
|
---|
| 575 | <xsl:call-template name="process.image.attributes">
|
---|
| 576 | <xsl:with-param name="alt">
|
---|
| 577 | <xsl:choose>
|
---|
| 578 | <xsl:when test="$alt != ''">
|
---|
| 579 | <xsl:copy-of select="$alt"/>
|
---|
| 580 | </xsl:when>
|
---|
| 581 | <xsl:when test="ancestor::figure">
|
---|
| 582 | <xsl:value-of select="normalize-space(ancestor::figure/title)"/>
|
---|
| 583 | </xsl:when>
|
---|
| 584 | </xsl:choose>
|
---|
| 585 | </xsl:with-param>
|
---|
| 586 | <xsl:with-param name="html.depth" select="$html.depth"/>
|
---|
| 587 | <xsl:with-param name="html.width" select="$html.width"/>
|
---|
| 588 | <xsl:with-param name="longdesc" select="$longdesc"/>
|
---|
| 589 | <xsl:with-param name="scale" select="$scale"/>
|
---|
| 590 | <xsl:with-param name="scalefit" select="$scalefit"/>
|
---|
| 591 | <xsl:with-param name="scaled.contentdepth" select="$scaled.contentdepth"/>
|
---|
| 592 | <xsl:with-param name="scaled.contentwidth" select="$scaled.contentwidth"/>
|
---|
| 593 | <xsl:with-param name="viewport" select="$viewport"/>
|
---|
| 594 | </xsl:call-template>
|
---|
| 595 | </xsl:element>
|
---|
| 596 | </xsl:otherwise>
|
---|
| 597 | </xsl:choose>
|
---|
| 598 | </xsl:variable>
|
---|
| 599 |
|
---|
| 600 | <xsl:variable name="bgcolor">
|
---|
| 601 | <xsl:call-template name="dbhtml-attribute">
|
---|
| 602 | <xsl:with-param name="pis" select="../processing-instruction('dbhtml')"/>
|
---|
| 603 | <xsl:with-param name="attribute" select="'background-color'"/>
|
---|
| 604 | </xsl:call-template>
|
---|
| 605 | </xsl:variable>
|
---|
| 606 |
|
---|
| 607 | <xsl:variable name="use.viewport" select="$viewport != 0 and ($html.width != '' or ($html.depth != '' and $depth-units != '%') or $bgcolor != '' or @valign)"/>
|
---|
| 608 |
|
---|
| 609 | <xsl:choose>
|
---|
| 610 | <xsl:when test="$use.viewport">
|
---|
| 611 | <table border="0" summary="manufactured viewport for HTML img" cellspacing="0" cellpadding="0">
|
---|
| 612 | <xsl:if test="$html.width != ''">
|
---|
| 613 | <xsl:attribute name="width">
|
---|
| 614 | <xsl:value-of select="$html.width"/>
|
---|
| 615 | </xsl:attribute>
|
---|
| 616 | </xsl:if>
|
---|
| 617 | <tr>
|
---|
| 618 | <xsl:if test="$html.depth != '' and $depth-units != '%'">
|
---|
| 619 | <!-- don't do this for percentages because browsers get confused -->
|
---|
| 620 | <xsl:choose>
|
---|
| 621 | <xsl:when test="$css.decoration != 0">
|
---|
| 622 | <xsl:attribute name="style">
|
---|
| 623 | <xsl:text>height: </xsl:text>
|
---|
| 624 | <xsl:value-of select="$html.depth"/>
|
---|
| 625 | <xsl:text>px</xsl:text>
|
---|
| 626 | </xsl:attribute>
|
---|
| 627 | </xsl:when>
|
---|
| 628 | <xsl:otherwise>
|
---|
| 629 | <xsl:attribute name="height">
|
---|
| 630 | <xsl:value-of select="$html.depth"/>
|
---|
| 631 | </xsl:attribute>
|
---|
| 632 | </xsl:otherwise>
|
---|
| 633 | </xsl:choose>
|
---|
| 634 | </xsl:if>
|
---|
| 635 | <td>
|
---|
| 636 | <xsl:if test="$bgcolor != ''">
|
---|
| 637 | <xsl:choose>
|
---|
| 638 | <xsl:when test="$css.decoration != 0">
|
---|
| 639 | <xsl:attribute name="style">
|
---|
| 640 | <xsl:text>background-color: </xsl:text>
|
---|
| 641 | <xsl:value-of select="$bgcolor"/>
|
---|
| 642 | </xsl:attribute>
|
---|
| 643 | </xsl:when>
|
---|
| 644 | <xsl:otherwise>
|
---|
| 645 | <xsl:attribute name="bgcolor">
|
---|
| 646 | <xsl:value-of select="$bgcolor"/>
|
---|
| 647 | </xsl:attribute>
|
---|
| 648 | </xsl:otherwise>
|
---|
| 649 | </xsl:choose>
|
---|
| 650 | </xsl:if>
|
---|
| 651 | <xsl:if test="@align">
|
---|
| 652 | <xsl:attribute name="align">
|
---|
| 653 | <xsl:value-of select="@align"/>
|
---|
| 654 | </xsl:attribute>
|
---|
| 655 | </xsl:if>
|
---|
| 656 | <xsl:if test="@valign">
|
---|
| 657 | <xsl:attribute name="valign">
|
---|
| 658 | <xsl:value-of select="@valign"/>
|
---|
| 659 | </xsl:attribute>
|
---|
| 660 | </xsl:if>
|
---|
| 661 | <xsl:copy-of select="$img"/>
|
---|
| 662 | </td>
|
---|
| 663 | </tr>
|
---|
| 664 | </table>
|
---|
| 665 | </xsl:when>
|
---|
| 666 | <xsl:otherwise>
|
---|
| 667 | <xsl:copy-of select="$img"/>
|
---|
| 668 | </xsl:otherwise>
|
---|
| 669 | </xsl:choose>
|
---|
| 670 |
|
---|
| 671 | <xsl:if test="$tag = 'img' and ../../self::imageobjectco and not($scaled)">
|
---|
| 672 | <xsl:variable name="mapname">
|
---|
| 673 | <xsl:call-template name="object.id">
|
---|
| 674 | <xsl:with-param name="object" select="../../areaspec"/>
|
---|
| 675 | </xsl:call-template>
|
---|
| 676 | </xsl:variable>
|
---|
| 677 |
|
---|
| 678 | <map name="{$mapname}">
|
---|
| 679 | <xsl:for-each select="../../areaspec//area">
|
---|
| 680 | <xsl:variable name="units">
|
---|
| 681 | <xsl:choose>
|
---|
| 682 | <xsl:when test="@units = 'other' and @otherunits">
|
---|
| 683 | <xsl:value-of select="@otherunits"/>
|
---|
| 684 | </xsl:when>
|
---|
| 685 | <xsl:when test="@units">
|
---|
| 686 | <xsl:value-of select="@units"/>
|
---|
| 687 | </xsl:when>
|
---|
| 688 | <!-- areaspec|areaset/area -->
|
---|
| 689 | <xsl:when test="../@units = 'other' and ../@otherunits">
|
---|
| 690 | <xsl:value-of select="../@otherunits"/>
|
---|
| 691 | </xsl:when>
|
---|
| 692 | <xsl:when test="../@units">
|
---|
| 693 | <xsl:value-of select="../@units"/>
|
---|
| 694 | </xsl:when>
|
---|
| 695 | <!-- areaspec/areaset/area -->
|
---|
| 696 | <xsl:when test="../../@units = 'other' and ../../@otherunits">
|
---|
| 697 | <xsl:value-of select="../@otherunits"/>
|
---|
| 698 | </xsl:when>
|
---|
| 699 | <xsl:when test="../../@units">
|
---|
| 700 | <xsl:value-of select="../../@units"/>
|
---|
| 701 | </xsl:when>
|
---|
| 702 | <xsl:otherwise>calspair</xsl:otherwise>
|
---|
| 703 | </xsl:choose>
|
---|
| 704 | </xsl:variable>
|
---|
| 705 |
|
---|
| 706 | <xsl:choose>
|
---|
| 707 | <xsl:when test="$units = 'calspair' or $units = 'imagemap'">
|
---|
| 708 | <xsl:variable name="coords" select="normalize-space(@coords)"/>
|
---|
| 709 |
|
---|
| 710 | <area shape="rect">
|
---|
| 711 | <xsl:variable name="linkends">
|
---|
| 712 | <xsl:choose>
|
---|
| 713 | <xsl:when test="@linkends">
|
---|
| 714 | <xsl:value-of select="normalize-space(@linkends)"/>
|
---|
| 715 | </xsl:when>
|
---|
| 716 | <xsl:otherwise>
|
---|
| 717 | <xsl:value-of select="normalize-space(../@linkends)"/>
|
---|
| 718 | </xsl:otherwise>
|
---|
| 719 | </xsl:choose>
|
---|
| 720 | </xsl:variable>
|
---|
| 721 |
|
---|
| 722 | <xsl:variable name="href">
|
---|
| 723 | <xsl:choose>
|
---|
| 724 | <xsl:when test="@xlink:href">
|
---|
| 725 | <xsl:value-of select="@xlink:href"/>
|
---|
| 726 | </xsl:when>
|
---|
| 727 | <xsl:otherwise>
|
---|
| 728 | <xsl:value-of select="../@xlink:href"/>
|
---|
| 729 | </xsl:otherwise>
|
---|
| 730 | </xsl:choose>
|
---|
| 731 | </xsl:variable>
|
---|
| 732 |
|
---|
| 733 | <xsl:choose>
|
---|
| 734 | <xsl:when test="$linkends != ''">
|
---|
| 735 | <xsl:variable name="linkend">
|
---|
| 736 | <xsl:choose>
|
---|
| 737 | <xsl:when test="contains($linkends, ' ')">
|
---|
| 738 | <xsl:value-of select="substring-before($linkends, ' ')"/>
|
---|
| 739 | </xsl:when>
|
---|
| 740 | <xsl:otherwise>
|
---|
| 741 | <xsl:value-of select="$linkends"/>
|
---|
| 742 | </xsl:otherwise>
|
---|
| 743 | </xsl:choose>
|
---|
| 744 | </xsl:variable>
|
---|
| 745 |
|
---|
| 746 | <xsl:variable name="target" select="key('id', $linkend)[1]"/>
|
---|
| 747 |
|
---|
| 748 | <xsl:if test="$target">
|
---|
| 749 | <xsl:attribute name="href">
|
---|
| 750 | <xsl:call-template name="href.target">
|
---|
| 751 | <xsl:with-param name="object" select="$target"/>
|
---|
| 752 | </xsl:call-template>
|
---|
| 753 | </xsl:attribute>
|
---|
| 754 | </xsl:if>
|
---|
| 755 | </xsl:when>
|
---|
| 756 | <xsl:when test="$href != ''">
|
---|
| 757 | <xsl:attribute name="href">
|
---|
| 758 | <xsl:value-of select="$href"/>
|
---|
| 759 | </xsl:attribute>
|
---|
| 760 | </xsl:when>
|
---|
| 761 | </xsl:choose>
|
---|
| 762 |
|
---|
| 763 | <xsl:if test="alt">
|
---|
| 764 | <xsl:attribute name="alt">
|
---|
| 765 | <xsl:value-of select="alt[1]"/>
|
---|
| 766 | </xsl:attribute>
|
---|
| 767 | </xsl:if>
|
---|
| 768 |
|
---|
| 769 | <xsl:attribute name="coords">
|
---|
| 770 | <xsl:choose>
|
---|
| 771 | <xsl:when test="$units = 'calspair'">
|
---|
| 772 |
|
---|
| 773 | <xsl:variable name="p1" select="substring-before($coords, ' ')"/>
|
---|
| 774 | <xsl:variable name="p2" select="substring-after($coords, ' ')"/>
|
---|
| 775 |
|
---|
| 776 | <xsl:variable name="x1" select="substring-before($p1,',')"/>
|
---|
| 777 | <xsl:variable name="y1" select="substring-after($p1,',')"/>
|
---|
| 778 | <xsl:variable name="x2" select="substring-before($p2,',')"/>
|
---|
| 779 | <xsl:variable name="y2" select="substring-after($p2,',')"/>
|
---|
| 780 |
|
---|
| 781 | <xsl:variable name="x1p" select="$x1 div 100.0"/>
|
---|
| 782 | <xsl:variable name="y1p" select="$y1 div 100.0"/>
|
---|
| 783 | <xsl:variable name="x2p" select="$x2 div 100.0"/>
|
---|
| 784 | <xsl:variable name="y2p" select="$y2 div 100.0"/>
|
---|
| 785 |
|
---|
| 786 | <!--
|
---|
| 787 | <xsl:message>
|
---|
| 788 | <xsl:text>units: </xsl:text>
|
---|
| 789 | <xsl:value-of select="$units"/>
|
---|
| 790 | <xsl:text> </xsl:text>
|
---|
| 791 | <xsl:value-of select="$x1p"/><xsl:text>, </xsl:text>
|
---|
| 792 | <xsl:value-of select="$y1p"/><xsl:text>, </xsl:text>
|
---|
| 793 | <xsl:value-of select="$x2p"/><xsl:text>, </xsl:text>
|
---|
| 794 | <xsl:value-of select="$y2p"/><xsl:text>, </xsl:text>
|
---|
| 795 | </xsl:message>
|
---|
| 796 |
|
---|
| 797 | <xsl:message>
|
---|
| 798 | <xsl:text> </xsl:text>
|
---|
| 799 | <xsl:value-of select="$intrinsicwidth"/>
|
---|
| 800 | <xsl:text>, </xsl:text>
|
---|
| 801 | <xsl:value-of select="$intrinsicdepth"/>
|
---|
| 802 | </xsl:message>
|
---|
| 803 |
|
---|
| 804 | <xsl:message>
|
---|
| 805 | <xsl:text> </xsl:text>
|
---|
| 806 | <xsl:value-of select="$units"/>
|
---|
| 807 | <xsl:text> </xsl:text>
|
---|
| 808 | <xsl:value-of
|
---|
| 809 | select="round($x1p * $intrinsicwidth div 100.0)"/>
|
---|
| 810 | <xsl:text>,</xsl:text>
|
---|
| 811 | <xsl:value-of select="round($intrinsicdepth
|
---|
| 812 | - ($y2p * $intrinsicdepth div 100.0))"/>
|
---|
| 813 | <xsl:text>,</xsl:text>
|
---|
| 814 | <xsl:value-of select="round($x2p *
|
---|
| 815 | $intrinsicwidth div 100.0)"/>
|
---|
| 816 | <xsl:text>,</xsl:text>
|
---|
| 817 | <xsl:value-of select="round($intrinsicdepth
|
---|
| 818 | - ($y1p * $intrinsicdepth div 100.0))"/>
|
---|
| 819 | </xsl:message>
|
---|
| 820 | -->
|
---|
| 821 | <xsl:value-of select="round($x1p * $intrinsicwidth div 100.0)"/>
|
---|
| 822 | <xsl:text>,</xsl:text>
|
---|
| 823 | <xsl:value-of select="round($intrinsicdepth - ($y2p * $intrinsicdepth div 100.0))"/>
|
---|
| 824 | <xsl:text>,</xsl:text>
|
---|
| 825 | <xsl:value-of select="round($x2p * $intrinsicwidth div 100.0)"/>
|
---|
| 826 | <xsl:text>,</xsl:text>
|
---|
| 827 | <xsl:value-of select="round($intrinsicdepth - ($y1p * $intrinsicdepth div 100.0))"/>
|
---|
| 828 | </xsl:when>
|
---|
| 829 | <xsl:otherwise>
|
---|
| 830 | <xsl:copy-of select="$coords"/>
|
---|
| 831 | </xsl:otherwise>
|
---|
| 832 | </xsl:choose>
|
---|
| 833 | </xsl:attribute>
|
---|
| 834 | </area>
|
---|
| 835 | </xsl:when>
|
---|
| 836 | <xsl:otherwise>
|
---|
| 837 | <xsl:message>
|
---|
| 838 | <xsl:text>Warning: only calspair or </xsl:text>
|
---|
| 839 | <xsl:text>otherunits='imagemap' supported </xsl:text>
|
---|
| 840 | <xsl:text>in imageobjectco</xsl:text>
|
---|
| 841 | </xsl:message>
|
---|
| 842 | </xsl:otherwise>
|
---|
| 843 | </xsl:choose>
|
---|
| 844 | </xsl:for-each>
|
---|
| 845 | </map>
|
---|
| 846 | </xsl:if>
|
---|
| 847 | </xsl:template>
|
---|
| 848 |
|
---|
| 849 | <xsl:template name="process.image.attributes">
|
---|
| 850 | <xsl:param name="alt"/>
|
---|
| 851 | <xsl:param name="html.width"/>
|
---|
| 852 | <xsl:param name="html.depth"/>
|
---|
| 853 | <xsl:param name="longdesc"/>
|
---|
| 854 | <xsl:param name="scale"/>
|
---|
| 855 | <xsl:param name="scalefit"/>
|
---|
| 856 | <xsl:param name="scaled.contentdepth"/>
|
---|
| 857 | <xsl:param name="scaled.contentwidth"/>
|
---|
| 858 | <xsl:param name="viewport"/>
|
---|
| 859 |
|
---|
| 860 | <xsl:choose>
|
---|
| 861 | <xsl:when test="@contentwidth or @contentdepth">
|
---|
| 862 | <!-- ignore @width/@depth, @scale, and @scalefit if specified -->
|
---|
| 863 | <xsl:if test="@contentwidth and $scaled.contentwidth != ''">
|
---|
| 864 | <xsl:attribute name="width">
|
---|
| 865 | <xsl:value-of select="$scaled.contentwidth"/>
|
---|
| 866 | </xsl:attribute>
|
---|
| 867 | </xsl:if>
|
---|
| 868 | <xsl:if test="@contentdepth and $scaled.contentdepth != ''">
|
---|
| 869 | <xsl:attribute name="height">
|
---|
| 870 | <xsl:value-of select="$scaled.contentdepth"/>
|
---|
| 871 | </xsl:attribute>
|
---|
| 872 | </xsl:if>
|
---|
| 873 | </xsl:when>
|
---|
| 874 |
|
---|
| 875 | <xsl:when test="number($scale) != 1.0">
|
---|
| 876 | <!-- scaling is always uniform, so we only have to specify one dimension -->
|
---|
| 877 | <!-- ignore @scalefit if specified -->
|
---|
| 878 | <xsl:attribute name="width">
|
---|
| 879 | <xsl:value-of select="$scaled.contentwidth"/>
|
---|
| 880 | </xsl:attribute>
|
---|
| 881 | </xsl:when>
|
---|
| 882 |
|
---|
| 883 | <xsl:when test="$scalefit != 0">
|
---|
| 884 | <xsl:choose>
|
---|
| 885 | <xsl:when test="contains($html.width, '%')">
|
---|
| 886 | <xsl:choose>
|
---|
| 887 | <xsl:when test="$viewport != 0">
|
---|
| 888 | <!-- The *viewport* will be scaled, so use 100% here! -->
|
---|
| 889 | <xsl:attribute name="width">
|
---|
| 890 | <xsl:value-of select="'100%'"/>
|
---|
| 891 | </xsl:attribute>
|
---|
| 892 | </xsl:when>
|
---|
| 893 | <xsl:otherwise>
|
---|
| 894 | <xsl:attribute name="width">
|
---|
| 895 | <xsl:value-of select="$html.width"/>
|
---|
| 896 | </xsl:attribute>
|
---|
| 897 | </xsl:otherwise>
|
---|
| 898 | </xsl:choose>
|
---|
| 899 | </xsl:when>
|
---|
| 900 |
|
---|
| 901 | <xsl:when test="contains($html.depth, '%')">
|
---|
| 902 | <!-- HTML doesn't deal with this case very well...do nothing -->
|
---|
| 903 | </xsl:when>
|
---|
| 904 |
|
---|
| 905 | <xsl:when test="$scaled.contentwidth != '' and $html.width != '' and $scaled.contentdepth != '' and $html.depth != ''">
|
---|
| 906 | <!-- scalefit should not be anamorphic; figure out which direction -->
|
---|
| 907 | <!-- has the limiting scale factor and scale in that direction -->
|
---|
| 908 | <xsl:choose>
|
---|
| 909 | <xsl:when test="$html.width div $scaled.contentwidth > $html.depth div $scaled.contentdepth">
|
---|
| 910 | <xsl:attribute name="height">
|
---|
| 911 | <xsl:value-of select="$html.depth"/>
|
---|
| 912 | </xsl:attribute>
|
---|
| 913 | </xsl:when>
|
---|
| 914 | <xsl:otherwise>
|
---|
| 915 | <xsl:attribute name="width">
|
---|
| 916 | <xsl:value-of select="$html.width"/>
|
---|
| 917 | </xsl:attribute>
|
---|
| 918 | </xsl:otherwise>
|
---|
| 919 | </xsl:choose>
|
---|
| 920 | </xsl:when>
|
---|
| 921 |
|
---|
| 922 | <xsl:when test="$scaled.contentwidth != '' and $html.width != ''">
|
---|
| 923 | <xsl:attribute name="width">
|
---|
| 924 | <xsl:value-of select="$html.width"/>
|
---|
| 925 | </xsl:attribute>
|
---|
| 926 | </xsl:when>
|
---|
| 927 |
|
---|
| 928 | <xsl:when test="$scaled.contentdepth != '' and $html.depth != ''">
|
---|
| 929 | <xsl:attribute name="height">
|
---|
| 930 | <xsl:value-of select="$html.depth"/>
|
---|
| 931 | </xsl:attribute>
|
---|
| 932 | </xsl:when>
|
---|
| 933 | </xsl:choose>
|
---|
| 934 | </xsl:when>
|
---|
| 935 | </xsl:choose>
|
---|
| 936 |
|
---|
| 937 | <xsl:if test="$alt != ''">
|
---|
| 938 | <xsl:attribute name="alt">
|
---|
| 939 | <xsl:value-of select="normalize-space($alt)"/>
|
---|
| 940 | </xsl:attribute>
|
---|
| 941 | </xsl:if>
|
---|
| 942 |
|
---|
| 943 | <xsl:if test="$longdesc != ''">
|
---|
| 944 | <xsl:attribute name="longdesc">
|
---|
| 945 | <xsl:value-of select="$longdesc"/>
|
---|
| 946 | </xsl:attribute>
|
---|
| 947 | </xsl:if>
|
---|
| 948 |
|
---|
| 949 | <xsl:if test="@align and $viewport = 0">
|
---|
| 950 | <xsl:attribute name="align">
|
---|
| 951 | <xsl:choose>
|
---|
| 952 | <xsl:when test="@align = 'center'">middle</xsl:when>
|
---|
| 953 | <xsl:otherwise>
|
---|
| 954 | <xsl:value-of select="@align"/>
|
---|
| 955 | </xsl:otherwise>
|
---|
| 956 | </xsl:choose>
|
---|
| 957 | </xsl:attribute>
|
---|
| 958 | </xsl:if>
|
---|
| 959 | </xsl:template>
|
---|
| 960 |
|
---|
| 961 | <!-- ==================================================================== -->
|
---|
| 962 |
|
---|
| 963 | <xsl:template match="graphic">
|
---|
| 964 | <xsl:choose>
|
---|
| 965 | <xsl:when test="parent::inlineequation">
|
---|
| 966 | <xsl:call-template name="anchor"/>
|
---|
| 967 | <xsl:call-template name="process.image"/>
|
---|
| 968 | </xsl:when>
|
---|
| 969 | <xsl:otherwise>
|
---|
| 970 | <div>
|
---|
| 971 | <xsl:if test="@align">
|
---|
| 972 | <xsl:attribute name="align">
|
---|
| 973 | <xsl:value-of select="@align"/>
|
---|
| 974 | </xsl:attribute>
|
---|
| 975 | </xsl:if>
|
---|
| 976 | <xsl:call-template name="anchor"/>
|
---|
| 977 | <xsl:call-template name="process.image"/>
|
---|
| 978 | </div>
|
---|
| 979 | </xsl:otherwise>
|
---|
| 980 | </xsl:choose>
|
---|
| 981 | </xsl:template>
|
---|
| 982 |
|
---|
| 983 | <xsl:template match="inlinegraphic">
|
---|
| 984 | <xsl:variable name="filename">
|
---|
| 985 | <xsl:choose>
|
---|
| 986 | <xsl:when test="@entityref">
|
---|
| 987 | <xsl:value-of select="unparsed-entity-uri(@entityref)"/>
|
---|
| 988 | </xsl:when>
|
---|
| 989 | <xsl:otherwise>
|
---|
| 990 | <xsl:apply-templates select="@fileref"/>
|
---|
| 991 | </xsl:otherwise>
|
---|
| 992 | </xsl:choose>
|
---|
| 993 | </xsl:variable>
|
---|
| 994 |
|
---|
| 995 | <xsl:call-template name="anchor"/>
|
---|
| 996 |
|
---|
| 997 | <xsl:choose>
|
---|
| 998 | <xsl:when test="@format='linespecific'">
|
---|
| 999 | <xsl:choose>
|
---|
| 1000 | <xsl:when test="$use.extensions != '0' and $textinsert.extension != '0'">
|
---|
| 1001 | <xsl:choose>
|
---|
| 1002 | <xsl:when test="element-available('stext:insertfile')">
|
---|
| 1003 | <stext:insertfile href="{$filename}" encoding="{$textdata.default.encoding}"/>
|
---|
| 1004 | </xsl:when>
|
---|
| 1005 | <xsl:when test="element-available('xtext:insertfile')">
|
---|
| 1006 | <xtext:insertfile href="{$filename}"/>
|
---|
| 1007 | </xsl:when>
|
---|
| 1008 | <xsl:otherwise>
|
---|
| 1009 | <xsl:message terminate="yes">
|
---|
| 1010 | <xsl:text>No insertfile extension available.</xsl:text>
|
---|
| 1011 | </xsl:message>
|
---|
| 1012 | </xsl:otherwise>
|
---|
| 1013 | </xsl:choose>
|
---|
| 1014 | </xsl:when>
|
---|
| 1015 | <xsl:otherwise>
|
---|
| 1016 | <a xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" href="{$filename}"/>
|
---|
| 1017 | </xsl:otherwise>
|
---|
| 1018 | </xsl:choose>
|
---|
| 1019 | </xsl:when>
|
---|
| 1020 | <xsl:otherwise>
|
---|
| 1021 | <xsl:call-template name="process.image"/>
|
---|
| 1022 | </xsl:otherwise>
|
---|
| 1023 | </xsl:choose>
|
---|
| 1024 | </xsl:template>
|
---|
| 1025 |
|
---|
| 1026 | <!-- ==================================================================== -->
|
---|
| 1027 |
|
---|
| 1028 | <xsl:template match="mediaobject|mediaobjectco">
|
---|
| 1029 |
|
---|
| 1030 | <xsl:variable name="olist" select="imageobject|imageobjectco |videoobject|audioobject |textobject"/>
|
---|
| 1031 |
|
---|
| 1032 | <xsl:variable name="object.index">
|
---|
| 1033 | <xsl:call-template name="select.mediaobject.index">
|
---|
| 1034 | <xsl:with-param name="olist" select="$olist"/>
|
---|
| 1035 | <xsl:with-param name="count" select="1"/>
|
---|
| 1036 | </xsl:call-template>
|
---|
| 1037 | </xsl:variable>
|
---|
| 1038 |
|
---|
| 1039 | <xsl:variable name="object" select="$olist[position() = $object.index]"/>
|
---|
| 1040 |
|
---|
| 1041 | <xsl:variable name="align">
|
---|
| 1042 | <xsl:value-of select="$object/descendant::imagedata[@align][1]/@align"/>
|
---|
| 1043 | </xsl:variable>
|
---|
| 1044 |
|
---|
| 1045 | <div>
|
---|
| 1046 | <xsl:apply-templates select="." mode="class.attribute"/>
|
---|
| 1047 | <xsl:if test="$align != '' ">
|
---|
| 1048 | <xsl:attribute name="align">
|
---|
| 1049 | <xsl:value-of select="$align"/>
|
---|
| 1050 | </xsl:attribute>
|
---|
| 1051 | </xsl:if>
|
---|
| 1052 | <xsl:call-template name="anchor"/>
|
---|
| 1053 |
|
---|
| 1054 | <xsl:apply-templates select="$object"/>
|
---|
| 1055 | <xsl:apply-templates select="caption"/>
|
---|
| 1056 | </div>
|
---|
| 1057 | </xsl:template>
|
---|
| 1058 |
|
---|
| 1059 | <xsl:template match="inlinemediaobject">
|
---|
| 1060 | <span>
|
---|
| 1061 | <xsl:apply-templates select="." mode="class.attribute"/>
|
---|
| 1062 | <xsl:call-template name="anchor"/>
|
---|
| 1063 | <xsl:call-template name="select.mediaobject"/>
|
---|
| 1064 | </span>
|
---|
| 1065 | </xsl:template>
|
---|
| 1066 |
|
---|
| 1067 | <xsl:template match="programlisting/inlinemediaobject |screen/inlinemediaobject" priority="2">
|
---|
| 1068 | <!-- the additional span causes problems in some cases -->
|
---|
| 1069 | <xsl:call-template name="select.mediaobject"/>
|
---|
| 1070 | </xsl:template>
|
---|
| 1071 |
|
---|
| 1072 | <!-- ==================================================================== -->
|
---|
| 1073 |
|
---|
| 1074 | <xsl:template match="imageobjectco">
|
---|
| 1075 | <xsl:call-template name="anchor"/>
|
---|
| 1076 | <xsl:apply-templates select="imageobject"/>
|
---|
| 1077 | <xsl:apply-templates select="calloutlist"/>
|
---|
| 1078 | </xsl:template>
|
---|
| 1079 |
|
---|
| 1080 | <xsl:template match="imageobject">
|
---|
| 1081 | <xsl:choose>
|
---|
| 1082 | <xsl:when xmlns:svg="http://www.w3.org/2000/svg" test="svg:*">
|
---|
| 1083 | <xsl:apply-templates/>
|
---|
| 1084 | </xsl:when>
|
---|
| 1085 | <xsl:otherwise>
|
---|
| 1086 | <xsl:apply-templates select="imagedata"/>
|
---|
| 1087 | </xsl:otherwise>
|
---|
| 1088 | </xsl:choose>
|
---|
| 1089 | </xsl:template>
|
---|
| 1090 |
|
---|
| 1091 | <xsl:template match="imagedata">
|
---|
| 1092 | <xsl:variable name="filename">
|
---|
| 1093 | <xsl:call-template name="mediaobject.filename">
|
---|
| 1094 | <xsl:with-param name="object" select=".."/>
|
---|
| 1095 | </xsl:call-template>
|
---|
| 1096 | </xsl:variable>
|
---|
| 1097 |
|
---|
| 1098 | <xsl:choose>
|
---|
| 1099 | <xsl:when test="@format='linespecific'">
|
---|
| 1100 | <xsl:choose>
|
---|
| 1101 | <xsl:when test="$use.extensions != '0' and $textinsert.extension != '0'">
|
---|
| 1102 | <xsl:choose>
|
---|
| 1103 | <xsl:when test="element-available('stext:insertfile')">
|
---|
| 1104 | <stext:insertfile href="{$filename}" encoding="{$textdata.default.encoding}"/>
|
---|
| 1105 | </xsl:when>
|
---|
| 1106 | <xsl:when test="element-available('xtext:insertfile')">
|
---|
| 1107 | <xtext:insertfile href="{$filename}"/>
|
---|
| 1108 | </xsl:when>
|
---|
| 1109 | <xsl:otherwise>
|
---|
| 1110 | <xsl:message terminate="yes">
|
---|
| 1111 | <xsl:text>No insertfile extension available.</xsl:text>
|
---|
| 1112 | </xsl:message>
|
---|
| 1113 | </xsl:otherwise>
|
---|
| 1114 | </xsl:choose>
|
---|
| 1115 | </xsl:when>
|
---|
| 1116 | <xsl:otherwise>
|
---|
| 1117 | <a xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" href="{$filename}"/>
|
---|
| 1118 | </xsl:otherwise>
|
---|
| 1119 | </xsl:choose>
|
---|
| 1120 | </xsl:when>
|
---|
| 1121 | <xsl:otherwise>
|
---|
| 1122 | <xsl:variable name="longdesc.uri">
|
---|
| 1123 | <xsl:call-template name="longdesc.uri">
|
---|
| 1124 | <xsl:with-param name="mediaobject" select="ancestor::imageobject/parent::*"/>
|
---|
| 1125 | </xsl:call-template>
|
---|
| 1126 | </xsl:variable>
|
---|
| 1127 |
|
---|
| 1128 | <xsl:variable name="phrases" select="ancestor::mediaobject/textobject[phrase] |ancestor::inlinemediaobject/textobject[phrase] |ancestor::mediaobjectco/textobject[phrase]"/>
|
---|
| 1129 |
|
---|
| 1130 | <xsl:call-template name="process.image">
|
---|
| 1131 | <xsl:with-param name="alt">
|
---|
| 1132 | <xsl:apply-templates select="$phrases[not(@role) or @role!='tex'][1]"/>
|
---|
| 1133 | </xsl:with-param>
|
---|
| 1134 | <xsl:with-param name="longdesc">
|
---|
| 1135 | <xsl:call-template name="write.longdesc">
|
---|
| 1136 | <xsl:with-param name="mediaobject" select="ancestor::imageobject/parent::*"/>
|
---|
| 1137 | </xsl:call-template>
|
---|
| 1138 | </xsl:with-param>
|
---|
| 1139 | </xsl:call-template>
|
---|
| 1140 |
|
---|
| 1141 | <xsl:if test="$html.longdesc != 0 and $html.longdesc.link != 0 and ancestor::imageobject/parent::*/textobject[not(phrase)]">
|
---|
| 1142 | <xsl:call-template name="longdesc.link">
|
---|
| 1143 | <xsl:with-param name="longdesc.uri" select="$longdesc.uri"/>
|
---|
| 1144 | </xsl:call-template>
|
---|
| 1145 | </xsl:if>
|
---|
| 1146 | </xsl:otherwise>
|
---|
| 1147 | </xsl:choose>
|
---|
| 1148 | </xsl:template>
|
---|
| 1149 |
|
---|
| 1150 | <!-- ==================================================================== -->
|
---|
| 1151 |
|
---|
| 1152 | <xsl:template name="longdesc.uri">
|
---|
| 1153 | <xsl:param name="mediaobject" select="."/>
|
---|
| 1154 | <xsl:if test="$html.longdesc">
|
---|
| 1155 | <xsl:if test="$mediaobject/textobject[not(phrase)]">
|
---|
| 1156 | <xsl:variable name="dbhtml.dir">
|
---|
| 1157 | <xsl:call-template name="dbhtml-dir"/>
|
---|
| 1158 | </xsl:variable>
|
---|
| 1159 | <xsl:variable name="filename">
|
---|
| 1160 | <xsl:call-template name="make-relative-filename">
|
---|
| 1161 | <xsl:with-param name="base.dir">
|
---|
| 1162 | <xsl:choose>
|
---|
| 1163 | <xsl:when test="$dbhtml.dir != ''">
|
---|
| 1164 | <xsl:value-of select="$dbhtml.dir"/>
|
---|
| 1165 | </xsl:when>
|
---|
| 1166 | <xsl:otherwise>
|
---|
| 1167 | <xsl:value-of select="$base.dir"/>
|
---|
| 1168 | </xsl:otherwise>
|
---|
| 1169 | </xsl:choose>
|
---|
| 1170 | </xsl:with-param>
|
---|
| 1171 | <xsl:with-param name="base.name">
|
---|
| 1172 | <xsl:choose>
|
---|
| 1173 | <xsl:when test=" $mediaobject/@*[local-name() = 'id'] and not($use.id.as.filename = 0)">
|
---|
| 1174 | <!-- * if this mediaobject has an ID, then we use the -->
|
---|
| 1175 | <!-- * value of that ID as basename for the "longdesc" -->
|
---|
| 1176 | <!-- * file (that is, without prepending an "ld-" too it) -->
|
---|
| 1177 | <xsl:value-of select="$mediaobject/@*[local-name() = 'id']"/>
|
---|
| 1178 | <xsl:value-of select="$html.ext"/>
|
---|
| 1179 | </xsl:when>
|
---|
| 1180 | <xsl:otherwise>
|
---|
| 1181 | <!-- * otherwise, if this mediaobject does not have an -->
|
---|
| 1182 | <!-- * ID, then we generate an ID... -->
|
---|
| 1183 | <xsl:variable name="image-id">
|
---|
| 1184 | <xsl:call-template name="object.id">
|
---|
| 1185 | <xsl:with-param name="object" select="$mediaobject"/>
|
---|
| 1186 | </xsl:call-template>
|
---|
| 1187 | </xsl:variable>
|
---|
| 1188 | <!-- * ...and then we take that generated ID, prepend an -->
|
---|
| 1189 | <!-- * "ld-" to it, and use that as the basename for the file -->
|
---|
| 1190 | <xsl:value-of select="concat('ld-',$image-id,$html.ext)"/>
|
---|
| 1191 | </xsl:otherwise>
|
---|
| 1192 | </xsl:choose>
|
---|
| 1193 | </xsl:with-param>
|
---|
| 1194 | </xsl:call-template>
|
---|
| 1195 | </xsl:variable>
|
---|
| 1196 |
|
---|
| 1197 | <xsl:value-of select="$filename"/>
|
---|
| 1198 | </xsl:if>
|
---|
| 1199 | </xsl:if>
|
---|
| 1200 | </xsl:template>
|
---|
| 1201 |
|
---|
| 1202 | <xsl:template name="write.longdesc">
|
---|
| 1203 | <xsl:param name="mediaobject" select="."/>
|
---|
| 1204 | <xsl:if test="$html.longdesc != 0 and $mediaobject/textobject[not(phrase)]">
|
---|
| 1205 | <xsl:variable name="filename">
|
---|
| 1206 | <xsl:call-template name="longdesc.uri">
|
---|
| 1207 | <xsl:with-param name="mediaobject" select="$mediaobject"/>
|
---|
| 1208 | </xsl:call-template>
|
---|
| 1209 | </xsl:variable>
|
---|
| 1210 |
|
---|
| 1211 | <xsl:value-of select="$filename"/>
|
---|
| 1212 |
|
---|
| 1213 | <xsl:call-template name="write.chunk">
|
---|
| 1214 | <xsl:with-param name="filename" select="$filename"/>
|
---|
| 1215 | <xsl:with-param name="quiet" select="$chunk.quietly"/>
|
---|
| 1216 | <xsl:with-param name="content">
|
---|
| 1217 | <xsl:call-template name="user.preroot"/>
|
---|
| 1218 | <html>
|
---|
| 1219 | <head>
|
---|
| 1220 | <xsl:call-template name="system.head.content"/>
|
---|
| 1221 | <xsl:call-template name="head.content">
|
---|
| 1222 | <xsl:with-param name="title" select="'Long Description'"/>
|
---|
| 1223 | </xsl:call-template>
|
---|
| 1224 | <xsl:call-template name="user.head.content"/>
|
---|
| 1225 | </head>
|
---|
| 1226 | <body>
|
---|
| 1227 | <xsl:call-template name="body.attributes"/>
|
---|
| 1228 | <xsl:for-each select="$mediaobject/textobject[not(phrase)]">
|
---|
| 1229 | <xsl:apply-templates select="./*"/>
|
---|
| 1230 | </xsl:for-each>
|
---|
| 1231 | </body>
|
---|
| 1232 | </html>
|
---|
| 1233 | <xsl:value-of select="$chunk.append"/>
|
---|
| 1234 | </xsl:with-param>
|
---|
| 1235 | </xsl:call-template>
|
---|
| 1236 | </xsl:if>
|
---|
| 1237 | </xsl:template>
|
---|
| 1238 |
|
---|
| 1239 | <xsl:template name="longdesc.link">
|
---|
| 1240 | <xsl:param name="longdesc.uri" select="''"/>
|
---|
| 1241 |
|
---|
| 1242 | <xsl:variable name="this.uri">
|
---|
| 1243 | <xsl:call-template name="make-relative-filename">
|
---|
| 1244 | <xsl:with-param name="base.dir" select="$base.dir"/>
|
---|
| 1245 | <xsl:with-param name="base.name">
|
---|
| 1246 | <xsl:call-template name="href.target.uri"/>
|
---|
| 1247 | </xsl:with-param>
|
---|
| 1248 | </xsl:call-template>
|
---|
| 1249 | </xsl:variable>
|
---|
| 1250 |
|
---|
| 1251 | <xsl:variable name="href.to">
|
---|
| 1252 | <xsl:call-template name="trim.common.uri.paths">
|
---|
| 1253 | <xsl:with-param name="uriA" select="$longdesc.uri"/>
|
---|
| 1254 | <xsl:with-param name="uriB" select="$this.uri"/>
|
---|
| 1255 | <xsl:with-param name="return" select="'A'"/>
|
---|
| 1256 | </xsl:call-template>
|
---|
| 1257 | </xsl:variable>
|
---|
| 1258 |
|
---|
| 1259 | <div class="longdesc-link" align="right">
|
---|
| 1260 | <br clear="all"/>
|
---|
| 1261 | <span class="longdesc-link">
|
---|
| 1262 | <xsl:text>[</xsl:text>
|
---|
| 1263 | <a href="{$href.to}" target="longdesc">D</a>
|
---|
| 1264 | <xsl:text>]</xsl:text>
|
---|
| 1265 | </span>
|
---|
| 1266 | </div>
|
---|
| 1267 | </xsl:template>
|
---|
| 1268 |
|
---|
| 1269 | <!-- ==================================================================== -->
|
---|
| 1270 |
|
---|
| 1271 | <xsl:template match="videoobject">
|
---|
| 1272 | <xsl:apply-templates select="videodata"/>
|
---|
| 1273 | </xsl:template>
|
---|
| 1274 |
|
---|
| 1275 | <xsl:template match="videodata">
|
---|
| 1276 | <xsl:call-template name="process.image">
|
---|
| 1277 | <xsl:with-param name="tag" select="'embed'"/>
|
---|
| 1278 | <xsl:with-param name="alt">
|
---|
| 1279 | <xsl:apply-templates select="(../../textobject/phrase)[1]"/>
|
---|
| 1280 | </xsl:with-param>
|
---|
| 1281 | </xsl:call-template>
|
---|
| 1282 | </xsl:template>
|
---|
| 1283 |
|
---|
| 1284 | <!-- ==================================================================== -->
|
---|
| 1285 |
|
---|
| 1286 | <xsl:template match="audioobject">
|
---|
| 1287 | <xsl:apply-templates select="audiodata"/>
|
---|
| 1288 | </xsl:template>
|
---|
| 1289 |
|
---|
| 1290 | <xsl:template match="audiodata">
|
---|
| 1291 | <xsl:call-template name="process.image">
|
---|
| 1292 | <xsl:with-param name="tag" select="'embed'"/>
|
---|
| 1293 | <xsl:with-param name="alt">
|
---|
| 1294 | <xsl:apply-templates select="(../../textobject/phrase)[1]"/>
|
---|
| 1295 | </xsl:with-param>
|
---|
| 1296 | </xsl:call-template>
|
---|
| 1297 | </xsl:template>
|
---|
| 1298 |
|
---|
| 1299 | <!-- ==================================================================== -->
|
---|
| 1300 |
|
---|
| 1301 | <xsl:template match="textobject">
|
---|
| 1302 | <xsl:apply-templates/>
|
---|
| 1303 | </xsl:template>
|
---|
| 1304 |
|
---|
| 1305 | <xsl:template match="textdata">
|
---|
| 1306 | <xsl:variable name="filename">
|
---|
| 1307 | <xsl:choose>
|
---|
| 1308 | <xsl:when test="@entityref">
|
---|
| 1309 | <xsl:value-of select="unparsed-entity-uri(@entityref)"/>
|
---|
| 1310 | </xsl:when>
|
---|
| 1311 | <xsl:otherwise>
|
---|
| 1312 | <xsl:apply-templates select="@fileref"/>
|
---|
| 1313 | </xsl:otherwise>
|
---|
| 1314 | </xsl:choose>
|
---|
| 1315 | </xsl:variable>
|
---|
| 1316 |
|
---|
| 1317 | <xsl:variable name="encoding">
|
---|
| 1318 | <xsl:choose>
|
---|
| 1319 | <xsl:when test="@encoding">
|
---|
| 1320 | <xsl:value-of select="@encoding"/>
|
---|
| 1321 | </xsl:when>
|
---|
| 1322 | <xsl:otherwise>
|
---|
| 1323 | <xsl:value-of select="$textdata.default.encoding"/>
|
---|
| 1324 | </xsl:otherwise>
|
---|
| 1325 | </xsl:choose>
|
---|
| 1326 | </xsl:variable>
|
---|
| 1327 |
|
---|
| 1328 | <xsl:choose>
|
---|
| 1329 | <xsl:when test="$use.extensions != '0' and $textinsert.extension != '0'">
|
---|
| 1330 | <xsl:choose>
|
---|
| 1331 | <xsl:when test="element-available('stext:insertfile')">
|
---|
| 1332 | <stext:insertfile href="{$filename}" encoding="{$encoding}"/>
|
---|
| 1333 | </xsl:when>
|
---|
| 1334 | <xsl:when test="element-available('xtext:insertfile')">
|
---|
| 1335 | <xtext:insertfile href="{$filename}"/>
|
---|
| 1336 | </xsl:when>
|
---|
| 1337 | <xsl:otherwise>
|
---|
| 1338 | <xsl:message terminate="yes">
|
---|
| 1339 | <xsl:text>No insertfile extension available.</xsl:text>
|
---|
| 1340 | </xsl:message>
|
---|
| 1341 | </xsl:otherwise>
|
---|
| 1342 | </xsl:choose>
|
---|
| 1343 | </xsl:when>
|
---|
| 1344 | <xsl:otherwise>
|
---|
| 1345 | <a xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" href="{$filename}"/>
|
---|
| 1346 | </xsl:otherwise>
|
---|
| 1347 | </xsl:choose>
|
---|
| 1348 | </xsl:template>
|
---|
| 1349 |
|
---|
| 1350 | <!-- ==================================================================== -->
|
---|
| 1351 |
|
---|
| 1352 | <xsl:template match="caption">
|
---|
| 1353 | <div>
|
---|
| 1354 | <xsl:apply-templates select="." mode="class.attribute"/>
|
---|
| 1355 | <xsl:if test="@align = 'right' or @align = 'left' or @align='center'">
|
---|
| 1356 | <xsl:attribute name="align"><xsl:value-of select="@align"/></xsl:attribute>
|
---|
| 1357 | </xsl:if>
|
---|
| 1358 | <xsl:apply-templates/>
|
---|
| 1359 | </div>
|
---|
| 1360 | </xsl:template>
|
---|
| 1361 |
|
---|
| 1362 | <!-- ==================================================================== -->
|
---|
| 1363 | <!-- "Support" for SVG -->
|
---|
| 1364 |
|
---|
| 1365 | <xsl:template xmlns:svg="http://www.w3.org/2000/svg" match="svg:*">
|
---|
| 1366 | <xsl:copy>
|
---|
| 1367 | <xsl:copy-of select="@*"/>
|
---|
| 1368 | <xsl:apply-templates/>
|
---|
| 1369 | </xsl:copy>
|
---|
| 1370 | </xsl:template>
|
---|
| 1371 |
|
---|
| 1372 |
|
---|
| 1373 | <!-- The following works sometimes, but needs to take into account
|
---|
| 1374 | 1. When there is no /*/@xml:base
|
---|
| 1375 | 2. When the chunks are going somewhere else
|
---|
| 1376 | <xsl:variable name="relpath">
|
---|
| 1377 | <xsl:call-template name="relative-uri">
|
---|
| 1378 | <xsl:with-param name="filename" select="@fileref"/>
|
---|
| 1379 | </xsl:call-template>
|
---|
| 1380 | </xsl:variable>
|
---|
| 1381 |
|
---|
| 1382 | <xsl:choose>
|
---|
| 1383 | <xsl:when test="/*/@xml:base
|
---|
| 1384 | and starts-with($relpath,/*/@xml:base)">
|
---|
| 1385 | <xsl:value-of select="substring-after($relpath,/*/@xml:base)"/>
|
---|
| 1386 | </xsl:when>
|
---|
| 1387 | <xsl:otherwise>
|
---|
| 1388 | <xsl:value-of select="@fileref"/>
|
---|
| 1389 | </xsl:otherwise>
|
---|
| 1390 | </xsl:choose>
|
---|
| 1391 | <xsl:value-of select="@fileref"/>
|
---|
| 1392 | </xsl:when>
|
---|
| 1393 | -->
|
---|
| 1394 | <!-- Resolve xml:base attributes -->
|
---|
| 1395 | <xsl:template match="@fileref">
|
---|
| 1396 | <!-- need a check for absolute urls -->
|
---|
| 1397 | <xsl:choose>
|
---|
| 1398 | <xsl:when test="contains(., ':')">
|
---|
| 1399 | <!-- it has a uri scheme so it is an absolute uri -->
|
---|
| 1400 | <xsl:value-of select="."/>
|
---|
| 1401 | </xsl:when>
|
---|
| 1402 | <xsl:when test="$keep.relative.image.uris != 0">
|
---|
| 1403 | <!-- leave it alone -->
|
---|
| 1404 | <xsl:value-of select="."/>
|
---|
| 1405 | </xsl:when>
|
---|
| 1406 | <xsl:otherwise>
|
---|
| 1407 | <!-- its a relative uri that needs xml:base processing -->
|
---|
| 1408 | <xsl:call-template name="relative-uri">
|
---|
| 1409 | </xsl:call-template>
|
---|
| 1410 | </xsl:otherwise>
|
---|
| 1411 | </xsl:choose>
|
---|
| 1412 | </xsl:template>
|
---|
| 1413 |
|
---|
| 1414 | </xsl:stylesheet>
|
---|