]> granicus.if.org Git - docbook-dsssl/commitdiff
Updated videodata template to handle new multimedia properties from DocBook 5.1b6.
authorBob Stayton <bobs@sagehill.net>
Sun, 15 Apr 2012 03:24:32 +0000 (03:24 +0000)
committerBob Stayton <bobs@sagehill.net>
Sun, 15 Apr 2012 03:24:32 +0000 (03:24 +0000)
Fixed TOC for qandadiv to output <ul> instead of <dl>.

xsl/xhtml5/html5-element-mods.xsl

index f40edc13d45d64364954abfcdb6add3b0f5d5946..7ddda52ee071ccd96cc83e1e015115c7d825a519 100644 (file)
   </xsl:if>
 </xsl:template>
 
+<!-- html5 uses <ul> instead of <dl> for toc -->
+<xsl:template name="process.qanda.toc">
+  <ul>
+    <xsl:apply-templates select="qandadiv" mode="qandatoc.mode"/>
+    <xsl:apply-templates select="qandaset|qandaentry" mode="qandatoc.mode"/>
+  </ul>
+</xsl:template>
+
+<xsl:template match="qandadiv" mode="qandatoc.mode">
+  <!--
+  <dt><xsl:apply-templates select="title" mode="qandatoc.mode"/></dt>
+  <dd><xsl:call-template name="process.qanda.toc"/></dd>
+  -->
+  <li>
+    <xsl:apply-templates select="title" mode="qandatoc.mode"/>
+    <xsl:call-template name="process.qanda.toc"/>
+  </li>
+</xsl:template>
+
 <!-- HTML5: each dt must have a dd -->
 <xsl:template match="indexterm" mode="index-primary">
   <xsl:param name="scope" select="."/>
   </xsl:variable>
 
   <audio>
-    <xsl:apply-templates select="." mode="class.attribute"/>
+    <xsl:call-template name="common.html.attributes"/>
+
     <xsl:attribute name="src">
       <xsl:value-of select="$filename"/>
     </xsl:attribute>
-    <xsl:attribute name="controls">controls</xsl:attribute>
-    <xsl:attribute name="autoplay"></xsl:attribute>
+
+    <xsl:apply-templates select="@*"/>
+    <xsl:apply-templates select="../multimediaparam"/>
 
     <!-- add any fallback content -->
     <xsl:call-template name="audio.fallback"/>
   </audio>
 </xsl:template>
 
+<!-- generate <video> element for html5 -->
 <xsl:template match="videodata">
   <xsl:variable name="filename">
     <xsl:call-template name="mediaobject.filename">
   </xsl:variable>
 
   <video>
-    <xsl:apply-templates select="." mode="class.attribute"/>
+    <xsl:call-template name="common.html.attributes"/>
+
     <xsl:attribute name="src">
       <xsl:value-of select="$filename"/>
     </xsl:attribute>
-    <xsl:attribute name="controls">controls</xsl:attribute>
-    <xsl:attribute name="autoplay"></xsl:attribute>
+
+    <xsl:call-template name="video.poster"/>
+
+    <xsl:apply-templates select="@*"/>
+    <xsl:apply-templates select="../multimediaparam"/>
     
     <!-- add any fallback content -->
     <xsl:call-template name="video.fallback"/>
   </video>
 </xsl:template>
 
+<!-- use only an imageobject with @role = 'poster' -->
+<xsl:template name="video.poster">
+  <xsl:variable name="imageobject" select="../../imageobject[@role = 'poster'][1]"/>
+  <xsl:if test="$imageobject">
+    <xsl:attribute name="poster">
+      <xsl:value-of select="$imageobject/imagedata/@fileref"/>
+    </xsl:attribute> 
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="videodata/@fileref">
+  <!-- already handled by videodata template -->
+</xsl:template>
+
+<xsl:template match="audiodata/@fileref">
+  <!-- already handled by audiodata template -->
+</xsl:template>
+
+<xsl:template match="videodata/@contentwidth">
+  <xsl:attribute name="width">
+    <xsl:value-of select="."/>
+  </xsl:attribute>
+</xsl:template>
+
+<xsl:template match="videodata/@contentdepth">
+  <xsl:attribute name="height">
+    <xsl:value-of select="."/>
+  </xsl:attribute>
+</xsl:template>
+
+<xsl:template match="videodata/@depth">
+  <xsl:attribute name="height">
+    <xsl:value-of select="."/>
+  </xsl:attribute>
+</xsl:template>
+
+<!-- pass through these attributes -->
+<xsl:template match="videodata/@autoplay |
+                     videodata/@controls |
+                     audiodata/@autoplay |
+                     audiodata/@controls">
+  <xsl:copy-of select="."/>
+</xsl:template>
+
+<xsl:template match="videodata/@*">
+  <!-- Do nothing with the rest of the attributes -->
+</xsl:template>
+
+<xsl:template match="audiodata/@*">
+  <!-- Do nothing with the rest of the attributes -->
+</xsl:template>
+
+<xsl:template match="multimediaparam">
+  <xsl:call-template name="process.multimediaparam">
+    <xsl:with-param name="object" select=".."/>
+    <xsl:with-param name="param.name" select="@name"/>
+    <xsl:with-param name="param.value" select="@value"/>
+  </xsl:call-template>
+</xsl:template>
+
+<!-- Determines the best value of a media attribute from the
+  attributes and multimediaparam elements -->
+<xsl:template name="process.multimediaparam">
+  <xsl:param name="object" select="NOTANELEMENT"/>
+  <xsl:param name="param.name"/>
+  <xsl:param name="param.value"/>
+
+  <xsl:choose>
+    <xsl:when test="$object/*/@*[local-name(.) = $param.name]">
+      <!-- explicit attribute with that name takes precedence -->
+      <xsl:attribute name="{$param.name}">
+        <xsl:value-of select="$object/*/@*[local-name(.) = $param.name]"/>
+      </xsl:attribute>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:attribute name="{$param.name}">
+        <xsl:value-of select="$param.value"/>
+      </xsl:attribute>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
 <xsl:template name="video.fallback">
   <xsl:param name="videodata" select="."/>
   <xsl:variable name="textobject" select="$videodata/../../textobject"/>