[yelp-xsl] mal2html-media: poster attribute for HTML video



commit c3e3bcf967c3023c3da39ebf5c9ee0d4efe036d5
Author: Shaun McCance <shaunm gnome org>
Date:   Tue Nov 13 10:09:52 2012 -0500

    mal2html-media: poster attribute for HTML video
    
    Use the first child image media element with style="poster"

 xslt/mallard/html/mal2html-media.xsl |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/xslt/mallard/html/mal2html-media.xsl b/xslt/mallard/html/mal2html-media.xsl
index e098c70..88bf0e9 100644
--- a/xslt/mallard/html/mal2html-media.xsl
+++ b/xslt/mallard/html/mal2html-media.xsl
@@ -98,6 +98,10 @@ This template outputs an HTML #{video} element for a Mallard #{media} element
 with the #{type} attribute set to #{"video"}. It converts any fallback content
 in the source to the #{video} element's fallback content. If ${inline} is
 #{false}, this template will process TTML child content.
+
+If ${node} has a child image #{media} element with the #{style} attribute set
+to #{"poster"}, that image will be used for the #{poster} attribute on the
+HTML #{video} element.
 -->
 <xsl:template name="mal2html.media.video">
   <xsl:param name="node" select="."/>
@@ -116,6 +120,13 @@ in the source to the #{video} element's fallback content. If ${inline} is
     </xsl:attribute>
     <xsl:copy-of select="$node/@height"/>
     <xsl:copy-of select="$node/@width"/>
+    <xsl:variable name="poster"
+                  select="$node/mal:media[not(@type) or @type = 'image'][ style = 'poster']"/>
+    <xsl:if test="$poster">
+      <xsl:attribute name="poster">
+        <xsl:value-of select="$poster[1]/@src"/>
+      </xsl:attribute>
+    </xsl:if>
     <xsl:attribute name="data-play-label">
       <xsl:call-template name="l10n.gettext">
         <xsl:with-param name="msgid" select="'Play'"/>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]