- Timestamp:
- 12/10/2013 11:37:38 PM (11 years ago)
- Branches:
- 7.5-systemd, 7.6-systemd, 7.7-systemd, 7.8-systemd, 7.9-systemd
- Children:
- 112db9d
- Parents:
- f2a5108
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
stylesheets/lfs-xsl/docbook-xsl-1.78.1/xhtml/graphics.xsl
rf2a5108 rb1a51ac1 5 5 6 6 <!-- ******************************************************************** 7 $Id $7 $Id: graphics.xsl 9710 2013-01-22 19:34:18Z bobstayton $ 8 8 ******************************************************************** 9 9 … … 31 31 <xsl:param name="ext"/> 32 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 = 'mp eg' or $lcext = 'qt' or $lcext = 'gif' or $lcext = 'bmp'">1</xsl:if>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> 34 34 </xsl:template> 35 35 … … 38 38 <xsl:template match="screenshot"> 39 39 <div> 40 <xsl:apply-templates select="." mode="class.attribute"/> 40 <xsl:apply-templates select="." mode="common.html.attributes"/> 41 <xsl:call-template name="id.attribute"/> 42 <xsl:call-template name="anchor"/> 41 43 <xsl:apply-templates/> 42 44 </div> 45 </xsl:template> 46 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> 43 51 </xsl:template> 44 52 … … 108 116 109 117 Scale can be problematic. Scale applies to the contentwidth, so 110 a scale of 50 when a contentwidth is not specified is anal ogous to a118 a scale of 50 when a contentwidth is not specified is analagous to a 111 119 width of 50%. (If a contentwidth is specified, the scaling factor can 112 120 be applied to that value and no problem exists.) … … 244 252 <!-- This funny compound test works around a bug in XSLTC --> 245 253 <xsl:choose> 246 <xsl:when test="$use.extensions != 0 and $graphicsize.extension != 0 ">254 <xsl:when test="$use.extensions != 0 and $graphicsize.extension != 0 and not(@format='SVG')"> 247 255 <xsl:choose> 248 256 <xsl:when test="function-available('simg:getWidth')"> … … 277 285 <!-- This funny compound test works around a bug in XSLTC --> 278 286 <xsl:choose> 279 <xsl:when test="$use.extensions != 0 and $graphicsize.extension != 0 ">287 <xsl:when test="$use.extensions != 0 and $graphicsize.extension != 0 and not(@format='SVG')"> 280 288 <xsl:choose> 281 289 <xsl:when test="function-available('simg:getDepth')"> … … 339 347 </xsl:call-template> 340 348 </xsl:variable> 341 <xsl:value-of select=" $cwidth.in.points div 72.0 * $pixels.per.inch * $scale"/>349 <xsl:value-of select="round($cwidth.in.points div 72.0 * $pixels.per.inch * $scale)"/> 342 350 </xsl:if> 343 351 </xsl:variable> … … 406 414 </xsl:call-template> 407 415 </xsl:variable> 408 <xsl:value-of select=" $cdepth.in.points div 72.0 * $pixels.per.inch * $scale"/>416 <xsl:value-of select="round($cdepth.in.points div 72.0 * $pixels.per.inch * $scale)"/> 409 417 </xsl:if> 410 418 </xsl:variable> … … 487 495 <xsl:choose> 488 496 <xsl:when test="@format = 'SVG'"> 489 <object data="{$output_filename}" type="image/svg+xml"> 490 <xsl:call-template name="process.image.attributes"> 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"> 491 507 <!--xsl:with-param name="alt" select="$alt"/ there's no alt here--> 492 508 <xsl:with-param name="html.depth" select="$html.depth"/> … … 510 526 </xsl:if> 511 527 <xsl:if test="$use.embed.for.svg != 0"> 512 <embed src="{$output_filename}" type="image/svg+xml"> 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> 513 537 <xsl:call-template name="process.image.attributes"> 514 538 <!--xsl:with-param name="alt" select="$alt"/ there's no alt here --> … … 579 603 </xsl:when> 580 604 <xsl:when test="ancestor::figure"> 581 <xsl:value-of select="normalize-space(ancestor::figure/title)"/> 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)"/> 582 609 </xsl:when> 583 610 </xsl:choose> … … 607 634 <xsl:choose> 608 635 <xsl:when test="$use.viewport"> 609 <table border="0" summary="manufactured viewport for HTML img" cellspacing="0" cellpadding="0"> 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> 610 643 <xsl:if test="$html.width != ''"> 611 644 <xsl:attribute name="width"> … … 939 972 </xsl:if> 940 973 974 <!-- Turn off longdesc attribute since not supported by browsers 941 975 <xsl:if test="$longdesc != ''"> 942 976 <xsl:attribute name="longdesc"> … … 944 978 </xsl:attribute> 945 979 </xsl:if> 980 --> 946 981 947 982 <xsl:if test="@align and $viewport = 0"> … … 955 990 </xsl:attribute> 956 991 </xsl:if> 957 </xsl:template> 992 993 <xsl:call-template name="extension.process.image.attributes"/> 994 </xsl:template> 995 996 <xsl:template name="extension.process.image.attributes"/> 958 997 959 998 <!-- ==================================================================== --> … … 962 1001 <xsl:choose> 963 1002 <xsl:when test="parent::inlineequation"> 964 <xsl:call-template name="anchor"/> 965 <xsl:call-template name="process.image"/> 1003 <span> 1004 <xsl:call-template name="id.attribute"/> 1005 <xsl:call-template name="anchor"/> 1006 <xsl:call-template name="process.image"/> 1007 </span> 966 1008 </xsl:when> 967 1009 <xsl:otherwise> 968 1010 <div> 1011 <xsl:call-template name="id.attribute"/> 969 1012 <xsl:if test="@align"> 970 1013 <xsl:attribute name="align"> … … 1012 1055 </xsl:when> 1013 1056 <xsl:otherwise> 1014 <a xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" href="{$filename}"/> 1015 </xsl:otherwise> 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> 1016 1062 </xsl:choose> 1017 1063 </xsl:when> … … 1042 1088 1043 1089 <div> 1044 <xsl:apply-templates select="." mode="c lass.attribute"/>1090 <xsl:apply-templates select="." mode="common.html.attributes"/> 1045 1091 <xsl:if test="$align != '' "> 1046 1092 <xsl:attribute name="align"> … … 1048 1094 </xsl:attribute> 1049 1095 </xsl:if> 1096 <xsl:call-template name="id.attribute"/> 1050 1097 <xsl:call-template name="anchor"/> 1051 1098 … … 1057 1104 <xsl:template match="inlinemediaobject"> 1058 1105 <span> 1059 <xsl:apply-templates select="." mode="class.attribute"/> 1106 <xsl:apply-templates select="." mode="common.html.attributes"/> 1107 <xsl:call-template name="id.attribute"/> 1060 1108 <xsl:call-template name="anchor"/> 1061 1109 <xsl:call-template name="select.mediaobject"/> … … 1072 1120 <xsl:template match="imageobjectco"> 1073 1121 <xsl:call-template name="anchor"/> 1074 <xsl:apply-templates select="imageobject"/> 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 1075 1144 <xsl:apply-templates select="calloutlist"/> 1145 1076 1146 </xsl:template> 1077 1147 … … 1130 1200 <xsl:call-template name="process.image"> 1131 1201 <xsl:with-param name="alt"> 1132 <xsl:apply-templates select="$phrases[not(@role) or @role!='tex'][1]"/> 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> 1133 1210 </xsl:with-param> 1134 1211 <xsl:with-param name="longdesc"> … … 1165 1242 </xsl:when> 1166 1243 <xsl:otherwise> 1167 <xsl:value-of select="$ base.dir"/>1244 <xsl:value-of select="$chunk.base.dir"/> 1168 1245 </xsl:otherwise> 1169 1246 </xsl:choose> … … 1242 1319 <xsl:variable name="this.uri"> 1243 1320 <xsl:call-template name="make-relative-filename"> 1244 <xsl:with-param name="base.dir" select="$ base.dir"/>1321 <xsl:with-param name="base.dir" select="$chunk.base.dir"/> 1245 1322 <xsl:with-param name="base.name"> 1246 1323 <xsl:call-template name="href.target.uri"/> … … 1257 1334 </xsl:variable> 1258 1335 1259 <div class="longdesc-link" align=" right">1336 <div class="longdesc-link" align="{$direction.align.end}"> 1260 1337 <br clear="all"/> 1261 1338 <span class="longdesc-link"> … … 1269 1346 <!-- ==================================================================== --> 1270 1347 1348 <xsl:template match="mediaobject/alt"> 1349 <xsl:apply-templates/> 1350 </xsl:template> 1351 1271 1352 <xsl:template match="videoobject"> 1272 1353 <xsl:apply-templates select="videodata"/> … … 1277 1358 <xsl:with-param name="tag" select="'embed'"/> 1278 1359 <xsl:with-param name="alt"> 1279 <xsl:apply-templates select="(../../textobject/phrase)[1]"/> 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> 1280 1368 </xsl:with-param> 1281 1369 </xsl:call-template> … … 1292 1380 <xsl:with-param name="tag" select="'embed'"/> 1293 1381 <xsl:with-param name="alt"> 1294 <xsl:apply-templates select="(../../textobject/phrase)[1]"/> 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> 1295 1390 </xsl:with-param> 1296 1391 </xsl:call-template> … … 1343 1438 </xsl:when> 1344 1439 <xsl:otherwise> 1345 <a xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" href="{$filename}"/> 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> 1346 1444 </xsl:otherwise> 1347 1445 </xsl:choose> … … 1352 1450 <xsl:template match="caption"> 1353 1451 <div> 1354 <xsl:apply-templates select="." mode="class.attribute"/> 1452 <xsl:apply-templates select="." mode="common.html.attributes"/> 1453 <xsl:call-template name="id.attribute"/> 1355 1454 <xsl:if test="@align = 'right' or @align = 'left' or @align='center'"> 1356 1455 <xsl:attribute name="align"><xsl:value-of select="@align"/></xsl:attribute>
Note:
See TracChangeset
for help on using the changeset viewer.