$v:media-type-map

$v:media-type-map — Mapping from extensions to media types.

Variable:
{http://docbook.org/ns/docbook/variables}media-type-map
Defined in:
modules/variable.xsl
Used in:
main.xsl

Synopsis

   |<xsl:variable name="v:media-type-map"
   |              as="map(xs:string, xs:string)">
   |   <xsl:map>
   |      <xsl:map-entry key="'.aac'" select="'audio/aac'"/>
   |      <xsl:map-entry key="'.abw'" select="'application/x-abiword'"/>
   |      <xsl:map-entry key="'.arc'" select="'application/x-freearc'"/>
   |      <xsl:map-entry key="'.avif'" select="'image/avif'"/>
   |      <xsl:map-entry key="'.avi'" select="'video/x-msvideo'"/>
   |      <xsl:map-entry key="'.azw'" select="'application/vnd.amazon.ebook'"/>
   |      <xsl:map-entry key="'.bin'" select="'application/octet-stream'"/>
   |      <xsl:map-entry key="'.bmp'" select="'image/bmp'"/>
   |      <xsl:map-entry key="'.bz'" select="'application/x-bzip'"/>
   |      <xsl:map-entry key="'.bz2'" select="'application/x-bzip2'"/>
   |      <xsl:map-entry key="'.cda'" select="'application/x-cdf'"/>
   |      <xsl:map-entry key="'.csh'" select="'application/x-csh'"/>
   |      <xsl:map-entry key="'.css'" select="'text/css'"/>
   |      <xsl:map-entry key="'.csv'" select="'text/csv'"/>
   |      <xsl:map-entry key="'.doc'" select="'application/msword'"/>
   |      <xsl:map-entry key="'.docx'"
   |                     select="'application/vnd.openxmlformats-officedocument.wordprocessingml.document'"/>
   |      <xsl:map-entry key="'.eot'" select="'application/vnd.ms-fontobject'"/>
   |      <xsl:map-entry key="'.epub'" select="'application/epub+zip'"/>
   |      <xsl:map-entry key="'.gz'" select="'application/gzip'"/>
   |      <xsl:map-entry key="'.gif'" select="'image/gif'"/>
   |      <xsl:map-entry key="'.htm'" select="'text/html'"/>
   |      <xsl:map-entry key="'.html'" select="'text/html'"/>
   |      <xsl:map-entry key="'.ico'" select="'image/vnd.microsoft.icon'"/>
   |      <xsl:map-entry key="'.ics'" select="'text/calendar'"/>
   |      <xsl:map-entry key="'.jar'" select="'application/java-archive'"/>
   |      <xsl:map-entry key="'.jpeg'" select="'image/jpeg'"/>
   |      <xsl:map-entry key="'.jpg'" select="'image/jpeg'"/>
   |      <xsl:map-entry key="'.js'" select="'text/javascript'"/>
   |      <xsl:map-entry key="'.json'" select="'application/json'"/>
   |      <xsl:map-entry key="'.jsonld'" select="'application/ld+json'"/>
   |      <xsl:map-entry key="'.mid'" select="'audio/midi'"/>
   |      <xsl:map-entry key="'.midi'" select="'audio/midi'"/>
   |      <xsl:map-entry key="'.mjs'" select="'text/javascript'"/>
   |      <xsl:map-entry key="'.m3u8'" select="'application/x-mpegURL'"/>
   |      <xsl:map-entry key="'.mp3'" select="'audio/mpeg'"/>
   |      <xsl:map-entry key="'.mp4'" select="'video/mp4'"/>
   |      <xsl:map-entry key="'.mpeg'" select="'video/mpeg'"/>
   |      <xsl:map-entry key="'.mpkg'" select="'application/vnd.apple.installer+xml'"/>
   |      <xsl:map-entry key="'.mov'" select="'video/quicktime'"/>
   |      <xsl:map-entry key="'.odp'" select="'application/vnd.oasis.opendocument.presentation'"/>
   |      <xsl:map-entry key="'.ods'" select="'application/vnd.oasis.opendocument.spreadsheet'"/>
   |      <xsl:map-entry key="'.odt'" select="'application/vnd.oasis.opendocument.text'"/>
   |      <xsl:map-entry key="'.oga'" select="'audio/ogg'"/>
   |      <xsl:map-entry key="'.ogv'" select="'video/ogg'"/>
   |      <xsl:map-entry key="'.ogx'" select="'application/ogg'"/>
   |      <xsl:map-entry key="'.opus'" select="'audio/opus'"/>
   |      <xsl:map-entry key="'.otf'" select="'font/otf'"/>
   |      <xsl:map-entry key="'.png'" select="'image/png'"/>
   |      <xsl:map-entry key="'.pdf'" select="'application/pdf'"/>
   |      <xsl:map-entry key="'.php'" select="'application/x-httpd-php'"/>
   |      <xsl:map-entry key="'.ppt'" select="'application/vnd.ms-powerpoint'"/>
   |      <xsl:map-entry key="'.pptx'"
   |                     select="'application/vnd.openxmlformats-officedocument.presentationml.presentation'"/>
   |      <xsl:map-entry key="'.rar'" select="'application/vnd.rar'"/>
   |      <xsl:map-entry key="'.rtf'" select="'application/rtf'"/>
   |      <xsl:map-entry key="'.sh'" select="'application/x-sh'"/>
   |      <xsl:map-entry key="'.svg'" select="'image/svg'"/>
   |      <!-- not image/svg+xml for epub -->
   |      <xsl:map-entry key="'.tar'" select="'application/x-tar'"/>
   |      <xsl:map-entry key="'.tif'" select="'image/tiff'"/>
   |      <xsl:map-entry key="'.tiff'" select="'image/tiff'"/>
   |      <xsl:map-entry key="'.ts'" select="'video/mp2t'"/>
   |      <xsl:map-entry key="'.ttf'" select="'font/ttf'"/>
   |      <xsl:map-entry key="'.txt'" select="'text/plain'"/>
   |      <xsl:map-entry key="'.text'" select="'text/plain'"/>
   |      <xsl:map-entry key="'.vsd'" select="'application/vnd.visio'"/>
   |      <xsl:map-entry key="'.wav'" select="'audio/wav'"/>
   |      <xsl:map-entry key="'.weba'" select="'audio/webm'"/>
   |      <xsl:map-entry key="'.webm'" select="'video/webm'"/>
   |      <xsl:map-entry key="'.webp'" select="'image/webp'"/>
   |      <xsl:map-entry key="'.wmv'" select="'video/x-ms-wmv'"/>
   |      <xsl:map-entry key="'.woff'" select="'font/woff'"/>
   |      <xsl:map-entry key="'.woff2'" select="'font/woff2'"/>
   |      <xsl:map-entry key="'.xhtml'" select="'application/xhtml+xml'"/>
   |      <xsl:map-entry key="'.xls'" select="'application/vnd.ms-excel'"/>
   |      <xsl:map-entry key="'.xlsx'"
   |                     select="'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'"/>
   |      <xsl:map-entry key="'.xml'" select="'application/xml'"/>
   |      <xsl:map-entry key="'.xul'" select="'application/vnd.mozilla.xul+xml'"/>
   |      <xsl:map-entry key="'.zip'" select="'application/zip'"/>
   |      <xsl:map-entry key="'.7z'" select="'application/x-7z-compressed'"/>
   |   </xsl:map>
   |</xsl:variable>

Description

When attempting to determine the media type of a file, the stylesheets use this map to check for a media type based on the filename (or URI) extension.

This mapping is derived from Mozilla’s list of common types. The “.3gp” and “.3g2” extensions have been removed because they have multiple mappings. The “.text”, “.mov”, “.m3u8”, and “.wmv” extensions have been added. The media type for “.svg” has been simplified to just “image/svg” because that seems to be what EPUB readers require.