reimplementing START attribute of OL to comply with EPUB
authorJonathan Blake <jonathan.blake@projectaon.org>
Wed, 3 Jul 2013 17:01:35 +0000 (17:01 +0000)
committerJonathan Blake <jonathan.blake@projectaon.org>
Wed, 3 Jul 2013 17:01:35 +0000 (17:01 +0000)
git-svn-id: https://projectaon.org/data/trunk@2241 f6f3e2d7-ff33-0410-aaf5-b4bee2cdac11

common/xsl/epub-xhtml.xsl

index 1e83052..1430ef3 100644 (file)
@@ -317,12 +317,29 @@ Todo:
 
  <xsl:template match="ol">
   <ol>
-   <xsl:if test="@start"><xsl:attribute name="start"><xsl:value-of select="@start" /></xsl:attribute></xsl:if>
+   <xsl:if test="@start">
+    <xsl:call-template name="ol-start-for-loop">
+     <xsl:with-param name="count" select="@start"/>
+    </xsl:call-template>
+   </xsl:if>
 
    <xsl:apply-templates />
   </ol>
  </xsl:template>
 
+ <xsl:template name="ol-start-for-loop">
+  <xsl:param name="i" select="0"/>
+  <xsl:param name="count"/>
+
+  <xsl:if test="number($i) &lt; number($count)">
+   <li style="visibility:hidden;height:0">&nbsp;</li>
+   <xsl:call-template name="ol-start-for-loop">
+    <xsl:with-param name="i" select="number($i) + 1"/>
+    <xsl:with-param name="count" select="$count"/>
+   </xsl:call-template>
+  </xsl:if>
+ </xsl:template>
+
  <xsl:template match="ul">
   <ul>
    <xsl:if test="self::*[@class='unbulleted']"><xsl:attribute name="class"><xsl:text>unbulleted</xsl:text></xsl:attribute></xsl:if>