[yelp-xsl] mal2html-media: Allow block content in tt:div



commit 92ec42c8469c1e8a6775b716f5be12482e580b81
Author: Shaun McCance <shaunm gnome org>
Date:   Wed Feb 29 12:31:34 2012 -0500

    mal2html-media: Allow block content in tt:div

 xslt/common/html.xsl                 |    4 +++
 xslt/mallard/html/mal2html-media.xsl |   39 +++++++++++++++++++++++++++------
 2 files changed, 36 insertions(+), 7 deletions(-)
---
diff --git a/xslt/common/html.xsl b/xslt/common/html.xsl
index 9d7b913..bca04c9 100644
--- a/xslt/common/html.xsl
+++ b/xslt/common/html.xsl
@@ -1228,6 +1228,10 @@ span.media-current {
   line-height: 20px;
 }
 div.media-ttml { margin: 0; padding: 0; }
+div.media-ttml-div {
+  text-align: </xsl:text><xsl:value-of select="$left"/><xsl:text>;
+  display: none;
+}
 div.media-ttml-p {
   text-align: </xsl:text><xsl:value-of select="$left"/><xsl:text>;
   display: none;
diff --git a/xslt/mallard/html/mal2html-media.xsl b/xslt/mallard/html/mal2html-media.xsl
index 932bd82..b5f7020 100644
--- a/xslt/mallard/html/mal2html-media.xsl
+++ b/xslt/mallard/html/mal2html-media.xsl
@@ -168,13 +168,38 @@ FIXME
 
 <xsl:template mode="mal2html.ttml.mode" match="tt:div">
   <xsl:param name="range"/>
-  <xsl:apply-templates mode="mal2html.ttml.mode" select="tt:div | tt:p">
-    <xsl:with-param name="range">
-      <xsl:call-template name="mal2html.ttml.time.range">
-        <xsl:with-param name="range" select="$range"/>
-      </xsl:call-template>
-    </xsl:with-param>
-  </xsl:apply-templates>
+  <xsl:variable name="beginend">
+    <xsl:call-template name="mal2html.ttml.time.range">
+      <xsl:with-param name="range" select="$range"/>
+    </xsl:call-template>
+  </xsl:variable>
+  <div class="media-ttml-node media-ttml-div">
+    <xsl:attribute name="data-ttml-begin">
+      <xsl:value-of select="substring-before($beginend, ',')"/>
+    </xsl:attribute>
+    <xsl:variable name="end" select="substring-after($beginend, ',')"/>
+    <xsl:if test="$end != 'â'">
+      <xsl:attribute name="data-ttml-end">
+        <xsl:value-of select="$end"/>
+      </xsl:attribute>
+    </xsl:if>
+    <xsl:for-each select="*">
+      <xsl:choose>
+        <xsl:when test="self::tt:*">
+          <xsl:apply-templates mode="mal2html.ttml.mode" select=".">
+            <xsl:with-param name="range">
+              <xsl:call-template name="mal2html.ttml.time.range">
+                <xsl:with-param name="range" select="$range"/>
+              </xsl:call-template>
+            </xsl:with-param>
+          </xsl:apply-templates>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:apply-templates mode="mal2html.block.mode" select="."/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+  </div>
 </xsl:template>
 
 <xsl:template mode="mal2html.ttml.mode" match="tt:p">



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