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