| 1 |
<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- --> |
| 2 |
<!-- |
| 3 |
This program is free software; you can redistribute it and/or modify it under |
| 4 |
the terms of the GNU Lesser General Public License as published by the Free |
| 5 |
Software Foundation; either version 2 of the License, or (at your option) any |
| 6 |
later version. |
| 7 |
|
| 8 |
This program is distributed in the hope that it will be useful, but WITHOUT |
| 9 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 10 |
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
| 11 |
details. |
| 12 |
|
| 13 |
You should have received a copy of the GNU Lesser General Public License |
| 14 |
along with this program; see the file COPYING.LGPL. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
--> |
| 16 |
<!DOCTYPE xsl:stylesheet [ |
| 17 |
<!ENTITY % selectors SYSTEM "../common/dita-selectors.mod"> |
| 18 |
%selectors; |
| 19 |
]> |
| 20 |
|
| 21 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
| 22 |
xmlns:yelp="http://projects.gnome.org/yelp/" |
| 23 |
xmlns="http://www.w3.org/1999/xhtml" |
| 24 |
exclude-result-prefixes="yelp" |
| 25 |
version="1.0"> |
| 26 |
|
| 27 |
<!--!!========================================================================== |
| 28 |
DITA to HTML - Media |
| 29 |
|
| 30 |
REMARK: Describe this module |
| 31 |
--> |
| 32 |
|
| 33 |
|
| 34 |
<!-- = image = --> |
| 35 |
<xsl:template mode="dita2html.topic.mode" match="&topic_image;"> |
| 36 |
<xsl:param name="usemap" select="''"/> |
| 37 |
<xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/> |
| 38 |
<xsl:variable name="placement"> |
| 39 |
<xsl:call-template name="dita.ref.conref.attr"> |
| 40 |
<xsl:with-param name="attr" select="'placement'"/> |
| 41 |
<xsl:with-param name="node" select="."/> |
| 42 |
<xsl:with-param name="conref" select="$conref"/> |
| 43 |
</xsl:call-template> |
| 44 |
</xsl:variable> |
| 45 |
<xsl:choose> |
| 46 |
<xsl:when test="$placement = 'break'"> |
| 47 |
<div> |
| 48 |
<xsl:call-template name="html.lang.attrs"/> |
| 49 |
<xsl:call-template name="html.class.attr"> |
| 50 |
<xsl:with-param name="class" select="'media media-image'"/> |
| 51 |
</xsl:call-template> |
| 52 |
<div class="inner"> |
| 53 |
<xsl:call-template name="_dita2html.image.img"> |
| 54 |
<xsl:with-param name="conref" select="$conref"/> |
| 55 |
<xsl:with-param name="usemap" select="$usemap"/> |
| 56 |
</xsl:call-template> |
| 57 |
</div> |
| 58 |
</div> |
| 59 |
</xsl:when> |
| 60 |
<xsl:otherwise> |
| 61 |
<span> |
| 62 |
<xsl:call-template name="html.lang.attrs"/> |
| 63 |
<xsl:call-template name="html.class.attr"> |
| 64 |
<xsl:with-param name="class" select="'media media-image'"/> |
| 65 |
</xsl:call-template> |
| 66 |
<xsl:call-template name="_dita2html.image.img"> |
| 67 |
<xsl:with-param name="conref" select="$conref"/> |
| 68 |
<xsl:with-param name="usemap" select="$usemap"/> |
| 69 |
</xsl:call-template> |
| 70 |
</span> |
| 71 |
</xsl:otherwise> |
| 72 |
</xsl:choose> |
| 73 |
</xsl:template> |
| 74 |
|
| 75 |
<!--#* _dita2html.image.img --> |
| 76 |
<xsl:template name="_dita2html.image.img"> |
| 77 |
<xsl:param name="node" select="."/> |
| 78 |
<xsl:param name="conref" select="yelp:dita.ref.conref($node)"/> |
| 79 |
<xsl:param name="usemap" select="''"/> |
| 80 |
<xsl:variable name="href"> |
| 81 |
<xsl:call-template name="dita.ref.conref.attr"> |
| 82 |
<xsl:with-param name="attr" select="'href'"/> |
| 83 |
<xsl:with-param name="node" select="$node"/> |
| 84 |
<xsl:with-param name="conref" select="$conref"/> |
| 85 |
</xsl:call-template> |
| 86 |
</xsl:variable> |
| 87 |
<img src="{$href}"> |
| 88 |
<xsl:if test="$node/@width"> |
| 89 |
<xsl:variable name="width"> |
| 90 |
<xsl:call-template name="dita.ref.conref.attr"> |
| 91 |
<xsl:with-param name="attr" select="'width'"/> |
| 92 |
<xsl:with-param name="node" select="$node"/> |
| 93 |
<xsl:with-param name="conref" select="$conref"/> |
| 94 |
</xsl:call-template> |
| 95 |
</xsl:variable> |
| 96 |
<xsl:if test="contains('1234567890', substring($width, string-length($width)))"> |
| 97 |
<xsl:attribute name="width"> |
| 98 |
<xsl:value-of select="$width"/> |
| 99 |
</xsl:attribute> |
| 100 |
</xsl:if> |
| 101 |
</xsl:if> |
| 102 |
<xsl:if test="$node/@height"> |
| 103 |
<xsl:variable name="height"> |
| 104 |
<xsl:call-template name="dita.ref.conref.attr"> |
| 105 |
<xsl:with-param name="attr" select="'height'"/> |
| 106 |
<xsl:with-param name="node" select="$node"/> |
| 107 |
<xsl:with-param name="conref" select="$conref"/> |
| 108 |
</xsl:call-template> |
| 109 |
</xsl:variable> |
| 110 |
<xsl:if test="contains('1234567890', substring($height, string-length($height)))"> |
| 111 |
<xsl:attribute name="height"> |
| 112 |
<xsl:value-of select="$height"/> |
| 113 |
</xsl:attribute> |
| 114 |
</xsl:if> |
| 115 |
</xsl:if> |
| 116 |
<xsl:if test="$usemap != ''"> |
| 117 |
<xsl:attribute name="usemap"> |
| 118 |
<xsl:value-of select="$usemap"/> |
| 119 |
</xsl:attribute> |
| 120 |
</xsl:if> |
| 121 |
<xsl:choose> |
| 122 |
<xsl:when test="&topic_alt;"> |
| 123 |
<xsl:attribute name="alt"> |
| 124 |
<xsl:apply-templates mode="dita2html.topic.mode" |
| 125 |
select="yelp:dita.ref.conref(&topic_alt;)/node()"/> |
| 126 |
</xsl:attribute> |
| 127 |
</xsl:when> |
| 128 |
<xsl:when test="@alt"> |
| 129 |
<xsl:attribute name="alt"> |
| 130 |
<xsl:call-template name="dita.ref.conref.attr"> |
| 131 |
<xsl:with-param name="attr" select="'alt'"/> |
| 132 |
<xsl:with-param name="node" select="$node"/> |
| 133 |
<xsl:with-param name="conref" select="$conref"/> |
| 134 |
</xsl:call-template> |
| 135 |
</xsl:attribute> |
| 136 |
</xsl:when> |
| 137 |
</xsl:choose> |
| 138 |
</img> |
| 139 |
</xsl:template> |
| 140 |
|
| 141 |
<!-- = imagemap = --> |
| 142 |
<xsl:template mode="dita2html.topic.mode" match="&topic_imagemap;"> |
| 143 |
<xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/> |
| 144 |
<xsl:variable name="name"> |
| 145 |
<xsl:choose> |
| 146 |
<xsl:when test="@id"> |
| 147 |
<xsl:value-of select="@id"/> |
| 148 |
</xsl:when> |
| 149 |
<xsl:otherwise> |
| 150 |
<xsl:value-of select="generate-id()"/> |
| 151 |
</xsl:otherwise> |
| 152 |
</xsl:choose> |
| 153 |
</xsl:variable> |
| 154 |
<xsl:apply-templates mode="dita2html.topic.mode" select="$conref/&topic_image;"> |
| 155 |
<xsl:with-param name="usemap" select="concat('#', $name)"/> |
| 156 |
</xsl:apply-templates> |
| 157 |
<map name="{$name}"> |
| 158 |
<xsl:call-template name="html.lang.attrs"/> |
| 159 |
<xsl:call-template name="html.class.attr"/> |
| 160 |
<xsl:apply-templates mode="dita2html.topic.mode" select="$conref/&topic_area;"/> |
| 161 |
</map> |
| 162 |
</xsl:template> |
| 163 |
|
| 164 |
<!-- = area = --> |
| 165 |
<xsl:template mode="dita2html.topic.mode" match="&topic_area;"> |
| 166 |
<xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/> |
| 167 |
<area> |
| 168 |
<xsl:call-template name="html.lang.attrs"/> |
| 169 |
<xsl:call-template name="html.class.attr"/> |
| 170 |
<xsl:attribute name="shape"> |
| 171 |
<xsl:value-of select="$conref/&topic_shape;"/> |
| 172 |
</xsl:attribute> |
| 173 |
<xsl:attribute name="coords"> |
| 174 |
<xsl:value-of select="$conref/&topic_coords;"/> |
| 175 |
</xsl:attribute> |
| 176 |
<xsl:for-each select="&topic_xref;[1]"> |
| 177 |
<xsl:attribute name="href"> |
| 178 |
<xsl:call-template name="dita.ref.href.target"/> |
| 179 |
</xsl:attribute> |
| 180 |
<xsl:attribute name="title"> |
| 181 |
<xsl:call-template name="dita.ref.href.content"/> |
| 182 |
</xsl:attribute> |
| 183 |
</xsl:for-each> |
| 184 |
</area> |
| 185 |
</xsl:template> |
| 186 |
|
| 187 |
<!-- = object = --> |
| 188 |
<xsl:template mode="dita2html.topic.mode" match="&topic_object;"> |
| 189 |
<xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/> |
| 190 |
<div> |
| 191 |
<xsl:call-template name="dita.id"/> |
| 192 |
<xsl:call-template name="html.lang.attrs"/> |
| 193 |
<xsl:call-template name="html.class.attr"> |
| 194 |
<xsl:with-param name="class" select="'dita-object'"/> |
| 195 |
</xsl:call-template> |
| 196 |
<xsl:apply-templates mode="dita2html.topic.mode" select="&topic_desc;"/> |
| 197 |
<div class="contents"> |
| 198 |
<xsl:element name="{local-name(.)}" namespace="{$html.namespace}"> |
| 199 |
<xsl:for-each select="@*[namespace-uri(.) = '']"> |
| 200 |
<xsl:attribute name="{local-name(.)}"> |
| 201 |
<xsl:call-template name="dita.ref.conref.attr"> |
| 202 |
<xsl:with-param name="attr" select="local-name(.)"/> |
| 203 |
<xsl:with-param name="conref" select="$conref"/> |
| 204 |
</xsl:call-template> |
| 205 |
</xsl:attribute> |
| 206 |
</xsl:for-each> |
| 207 |
<xsl:apply-templates mode="dita2html.topic.mode" select="$conref/&topic_param;"/> |
| 208 |
</xsl:element> |
| 209 |
</div> |
| 210 |
</div> |
| 211 |
</xsl:template> |
| 212 |
|
| 213 |
<!-- = param = --> |
| 214 |
<xsl:template mode="dita2html.topic.mode" match="&topic_param;"> |
| 215 |
<xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/> |
| 216 |
<xsl:element name="{local-name(.)}" namespace="{$html.namespace}"> |
| 217 |
<xsl:call-template name="dita.id"/> |
| 218 |
<xsl:call-template name="html.lang.attrs"/> |
| 219 |
<xsl:call-template name="html.class.attr"/> |
| 220 |
<xsl:for-each select="@*[namespace-uri(.) = '']"> |
| 221 |
<xsl:attribute name="{local-name(.)}"> |
| 222 |
<xsl:call-template name="dita.ref.conref.attr"> |
| 223 |
<xsl:with-param name="attr" select="local-name(.)"/> |
| 224 |
<xsl:with-param name="node" select="$node"/> |
| 225 |
<xsl:with-param name="conref" select="$conref"/> |
| 226 |
</xsl:call-template> |
| 227 |
</xsl:attribute> |
| 228 |
</xsl:for-each> |
| 229 |
</xsl:element> |
| 230 |
</xsl:template> |
| 231 |
|
| 232 |
</xsl:stylesheet> |