reimplementing START attribute of OL to comply with EPUB
[project-aon.git] / 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>