<?xml version='1.0'?>
+<!DOCTYPE xsl:stylesheet [
+<!ENTITY lowercase "'abcdefghijklmnopqrstuvwxyz'">
+<!ENTITY uppercase "'ABCDEFGHIJKLMNOPQRSTUVWXYZ'">
+ ]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
xmlns:dyn="http://exslt.org/dynamic"
</xsl:otherwise>
</xsl:choose>
</xsl:template>
+
+
+<doc:template name="graphic.format.content-type" xmlns="">
+ <refpurpose>Returns mimetype for media format</refpurpose>
+ <refdescription id="graphic.format.content-type-desc">
+ <para>This takes as input a 'format' param and returns
+ a mimetype string. It uses an xsl:choose after first
+ converting the input to all uppercase.</para>
+ </refdescription>
+</doc:template>
+<xsl:template name="graphic.format.content-type">
+ <xsl:param name="format"/>
+ <xsl:variable name="upperformat" select="translate($format,&lowercase;,&uppercase;)"/>
+ <xsl:choose>
+ <xsl:when test="$upperformat = ''"></xsl:when>
+ <xsl:when test="$upperformat = 'linespecific'"></xsl:when>
+ <xsl:when test="$upperformat = 'PS'">application/postscript</xsl:when>
+ <xsl:when test="$upperformat = 'PDF'">application/pdf</xsl:when>
+ <xsl:when test="$upperformat = 'PNG'">image/png</xsl:when>
+ <xsl:when test="$upperformat = 'SVG'">image/svg+xml</xsl:when>
+ <xsl:when test="$upperformat = 'JPG'">image/jpeg</xsl:when>
+ <xsl:when test="$upperformat = 'JPEG'">image/jpeg</xsl:when>
+ <xsl:when test="$upperformat = 'GIF'">image/gif</xsl:when>
+ <xsl:when test="$upperformat = 'GIF87A'">image/gif</xsl:when>
+ <xsl:when test="$upperformat = 'GIF89A'">image/gif</xsl:when>
+ <xsl:when test="$upperformat = 'ACC'">audio/acc</xsl:when>
+ <xsl:when test="$upperformat = 'MPG'">audio/mpeg</xsl:when>
+ <xsl:when test="$upperformat = 'MP1'">audio/mpeg</xsl:when>
+ <xsl:when test="$upperformat = 'MP2'">audio/mpeg</xsl:when>
+ <xsl:when test="$upperformat = 'MP3'">audio/mpeg</xsl:when>
+ <xsl:when test="$upperformat = 'M4A'">audio/mp4</xsl:when>
+ <xsl:when test="$upperformat = 'MPEG'">audio/mpeg</xsl:when>
+ <xsl:when test="$upperformat = 'WAV'">audio/wav</xsl:when>
+ <xsl:when test="$upperformat = 'MP4'">video/mp4</xsl:when>
+ <xsl:when test="$upperformat = 'M4V'">video/mp4</xsl:when>
+ <xsl:when test="$upperformat = 'OGV'">video/ogg</xsl:when>
+ <xsl:when test="$upperformat = 'OGG'">video/ogg</xsl:when>
+ <xsl:when test="$upperformat = 'WEBM'">video/webm</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('image/', $upperformat)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
</xsl:stylesheet>
</xsl:if>
</xsl:template>
-<xsl:template name="graphic.format.content-type">
- <xsl:param name="format" select="''"/>
- <xsl:choose>
- <xsl:when test="$format = ''"></xsl:when>
- <xsl:when test="$format = 'linespecific'"></xsl:when>
- <xsl:when test="$format = 'PS'">application/postscript</xsl:when>
- <xsl:when test="$format = 'PDF'">application/pdf</xsl:when>
- <xsl:when test="$format = 'PNG'">image/png</xsl:when>
- <xsl:when test="$format = 'SVG'">image/svg+xml</xsl:when>
- <xsl:when test="$format = 'JPG'">image/jpeg</xsl:when>
- <xsl:when test="$format = 'GIF87a'">image/gif</xsl:when>
- <xsl:when test="$format = 'GIF89a'">image/gif</xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat('image/',
- translate($format, &uppercase;, &lowercase;))"/>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
<xsl:template name="manifest.toc">
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:template match="mediaobject|inlinemediaobject" mode="enumerate-images">
- <xsl:variable name="olist" select="imageobject|imageobjectco|
- videoobject|audioobject|
- textobject"/>
+ <xsl:variable name="olist"
+ select="imageobject[not(@role = 'poster')]
+ |imageobjectco
+ |videoobject
+ |audioobject
+ |textobject"/>
<xsl:variable name="object.index">
<xsl:call-template name="select.mediaobject.index">
<xsl:variable name="object" select="$olist[position() = $object.index]"/>
+ <xsl:apply-templates select="$object" mode="enumerate-images"/>
+
+ <!-- also include a poster image if present -->
+ <xsl:apply-templates select="imageobject[@role = 'poster']" mode="enumerate-images"/>
+
+</xsl:template>
+
+<xsl:template match="imageobject|videoobject|audioobject" mode="enumerate-images">
+ <xsl:param name="object" select="."/>
+
<xsl:if test="$object">
<xsl:variable name="image.filename">
<xsl:call-template name="mediaobject.filename">
</xsl:if>
</xsl:template>
-
+
<!-- Add in the generated images -->
<xsl:template match="note|caution|warning|important|tip" mode="enumerate-images">
<xsl:if test="$admon.graphics != 0">
concat(' ', $lcext, ' '))">1</xsl:if>
</xsl:template>
-<xsl:template name="graphic.format.content-type">
- <xsl:param name="format"/>
- <xsl:variable name="is.graphic.format">
- <xsl:call-template name="is.graphic.format">
- <xsl:with-param name="format" select="$format"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:if test="$is.graphic.format">
- <xsl:choose>
- <xsl:when test="$format = ''"></xsl:when>
- <xsl:when test="$format = 'linespecific'"></xsl:when>
- <xsl:when test="$format = 'PS'">application/postscript</xsl:when>
- <xsl:when test="$format = 'PDF'">application/pdf</xsl:when>
- <xsl:when test="$format = 'PNG'">image/png</xsl:when>
- <xsl:when test="$format = 'SVG'">image/svg+xml</xsl:when>
- <xsl:when test="$format = 'JPG'">image/jpeg</xsl:when>
- <xsl:when test="$format = 'GIF87a'">image/gif</xsl:when>
- <xsl:when test="$format = 'GIF89a'">image/gif</xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat('image/',
- translate($format, &uppercase;, &lowercase;))"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
-</xsl:template>
-
<!-- ==================================================================== -->
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>
</xsl:template>