Review using spellchecker, fixing accents and a number of typos
[project-aon.git] / common / xsl / epub-xhtml.xsl
index 794fbc4..5967d47 100644 (file)
@@ -72,7 +72,7 @@ Todo:
  <!-- :::::::::::: third-level front matter sections ::::::::::::: -->
 
  <xsl:template match="/gamebook/section/data/section/data/section[@class='frontmatter']">
-  <h3><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:apply-templates select="meta/title[1]" /></a></h3>
+  <h3><xsl:apply-templates select="meta/title[1]" /></h3>
 
   <xsl:apply-templates />
  </xsl:template>
@@ -87,7 +87,7 @@ Todo:
  <!-- :::::::::::: fourth-level front matter sections :::::::::::: -->
 
  <xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='frontmatter']">
-  <h4><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:apply-templates select="meta/title[1]" /></a></h4>
+  <h4><xsl:apply-templates select="meta/title[1]" /></h4>
 
   <xsl:apply-templates />
  </xsl:template>
@@ -95,7 +95,7 @@ Todo:
  <!-- ::::::::::::: fifth-level front matter sections :::::::::::: -->
 
  <xsl:template match="/gamebook/section/data/section/data/section/data/section/data/section[@class='frontmatter']">
-  <h5><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:apply-templates select="meta/title[1]" /></a></h5>
+  <h5><xsl:apply-templates select="meta/title[1]" /></h5>
 
   <xsl:apply-templates />
  </xsl:template>
@@ -112,7 +112,7 @@ Todo:
  <!-- :::::::::::: third-level main matter sections ::::::::::::: -->
 
  <xsl:template match="/gamebook/section/data/section/data/section[@class='mainmatter']">
-  <h3><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:apply-templates select="meta/title[1]" /></a></h3>
+  <h3><xsl:apply-templates select="meta/title[1]" /></h3>
 
   <xsl:apply-templates />
  </xsl:template>
@@ -127,7 +127,7 @@ Todo:
  <!-- :::::::::::: fourth-level main matter sections :::::::::::: -->
 
  <xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='mainmatter']">
-  <h4><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:apply-templates select="meta/title[1]" /></a></h4>
+  <h4><xsl:apply-templates select="meta/title[1]" /></h4>
 
   <xsl:apply-templates />
  </xsl:template>
@@ -135,7 +135,7 @@ Todo:
  <!-- ::::::::::::: fifth-level main matter sections :::::::::::: -->
 
  <xsl:template match="/gamebook/section/data/section/data/section/data/section/data/section[@class='mainmatter']">
-  <h5><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:apply-templates select="meta/title[1]" /></a></h5>
+  <h5><xsl:apply-templates select="meta/title[1]" /></h5>
 
   <xsl:apply-templates />
  </xsl:template>
@@ -154,7 +154,7 @@ Todo:
  <!-- glossary sections should be enclosed in a second level glossary section -->
 
  <xsl:template match="/gamebook/section/data/section/data/section[@class='glossary']">
-  <h3><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:apply-templates select="meta/title[1]" /></a></h3>
+  <h3><xsl:apply-templates select="meta/title[1]" /></h3>
 
   <xsl:apply-templates />
  </xsl:template>
@@ -197,7 +197,7 @@ Todo:
  <!-- ::::::::::::: third-level back matter sections ::::::::::::: -->
 
  <xsl:template match="/gamebook/section/data/section/data/section[@class='backmatter']">
-  <h3><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:apply-templates select="meta/title[1]" /></a></h3>
+  <h3><xsl:apply-templates select="meta/title[1]" /></h3>
 
   <xsl:apply-templates />
  </xsl:template>
@@ -205,7 +205,7 @@ Todo:
  <!-- ::::::::::::: fourth-level back matter sections ::::::::::::: -->
 
  <xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='backmatter']">
-  <h4><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:apply-templates select="meta/title[1]" /></a></h4>
+  <h4><xsl:apply-templates select="meta/title[1]" /></h4>
 
   <xsl:apply-templates />
  </xsl:template>
@@ -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>
@@ -526,13 +543,13 @@ Todo:
 
  <xsl:template match="puzzle">
   <p class="puzzle">
-   <xsl:apply-templates /><xsl:value-of select="$newline" />
+   <xsl:apply-templates />
   </p>
  </xsl:template>
  
  <xsl:template match="deadend">
   <p class="deadend">
-   <xsl:apply-templates /><xsl:value-of select="$newline" />
+   <xsl:apply-templates />
   </p>
  </xsl:template>
 
@@ -540,7 +557,6 @@ Todo:
   <div class="signpost">
    <xsl:apply-templates />
   </div>
-
  </xsl:template>
 
  <xsl:template match="signpost">
@@ -702,7 +718,6 @@ Todo:
    <xsl:when test="@href">
     <a>
      <xsl:attribute name="href"><xsl:value-of select="@href" /></xsl:attribute>
-     <xsl:if test="@id"><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute></xsl:if>
      <xsl:apply-templates />
     </a>
    </xsl:when>
@@ -729,16 +744,16 @@ Todo:
          <xsl:value-of select="$my-idref" /><xsl:value-of select="$xhtml-ext"/>
         </xsl:when>
         <xsl:when test="/gamebook/section/data/section/data/section[@class='frontmatter-separate' and descendant::*[@id=$my-idref]]">
-         <xsl:value-of select="/gamebook/section/data/section/data/section[@class='frontmatter-separate' and descendant::*[@id=$my-idref]]/@id" /><xsl:value-of select="$xhtml-ext"/><xsl:text>#</xsl:text><xsl:value-of select="$my-idref" />
+         <xsl:value-of select="/gamebook/section/data/section/data/section[@class='frontmatter-separate' and descendant::*[@id=$my-idref]]/@id" /><xsl:value-of select="$xhtml-ext"/>
         </xsl:when>
         <xsl:when test="/gamebook/section/data/section/data/section[@class='mainmatter-separate' and descendant::*[@id=$my-idref]]">
-         <xsl:value-of select="/gamebook/section/data/section/data/section[@class='mainmatter-separate' and descendant::*[@id=$my-idref]]/@id" /><xsl:value-of select="$xhtml-ext"/><xsl:text>#</xsl:text><xsl:value-of select="$my-idref" />
+         <xsl:value-of select="/gamebook/section/data/section/data/section[@class='mainmatter-separate' and descendant::*[@id=$my-idref]]/@id" /><xsl:value-of select="$xhtml-ext"/>
         </xsl:when>
         <xsl:when test="/gamebook/section/data/section/data/section[@class='glossary-separate' and descendant::*[@id=$my-idref]]">
-         <xsl:value-of select="/gamebook/section/data/section/data/section[@class='glossary-separate' and descendant::*[@id=$my-idref]]/@id" /><xsl:value-of select="$xhtml-ext"/><xsl:text>#</xsl:text><xsl:value-of select="$my-idref" />
+         <xsl:value-of select="/gamebook/section/data/section/data/section[@class='glossary-separate' and descendant::*[@id=$my-idref]]/@id" /><xsl:value-of select="$xhtml-ext"/>
         </xsl:when>
         <xsl:when test="/gamebook/section/data/section[descendant::*[@id=$my-idref]]">
-         <xsl:value-of select="/gamebook/section/data/section[descendant::*[@id=$my-idref]]/@id" /><xsl:value-of select="$xhtml-ext"/><xsl:text>#</xsl:text><xsl:value-of select="$my-idref" />
+         <xsl:value-of select="/gamebook/section/data/section[descendant::*[@id=$my-idref]]/@id" /><xsl:value-of select="$xhtml-ext"/>
         </xsl:when>
         <xsl:otherwise>
          <xsl:text>[error: a template]</xsl:text>
@@ -747,7 +762,6 @@ Todo:
        </xsl:choose>
       </xsl:attribute>
      </xsl:if>
-     <xsl:if test="@id"><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute></xsl:if>
      <xsl:apply-templates />
     </a>
    </xsl:otherwise>
@@ -759,11 +773,7 @@ Todo:
   <!-- <xsl:message><xsl:text>WARNING: Obsolete &lt;a idref='...' class='footnote' /&gt; usage</xsl:text></xsl:message> -->
   <xsl:apply-templates />
   <sup>
-   <a>
-    <xsl:attribute name="href"><xsl:text>#</xsl:text><xsl:value-of select="@idref" /></xsl:attribute>
-    <xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute>
-    <xsl:number count="a[@class='footnote']" from="/" level="any" format="1" />
-   </a>
+   <xsl:number count="a[@class='footnote']" from="/" level="any" format="1" />
   </sup>
  </xsl:template>
 
@@ -782,44 +792,40 @@ Todo:
  <!-- TODO: references to external books will not work in Ebooks -->
  <!--       should they be skipped or modified to point to the online book? -->
  <xsl:template match="bookref">
 <a>
  <xsl:attribute name="href">
   <xsl:variable name="my-section">
    <xsl:choose>
     <xsl:when test="@section">
      <xsl:value-of select="@section" />
     </xsl:when>
     <xsl:otherwise>
      <xsl:text>title</xsl:text>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:variable>
   <xsl:variable name="my-series">
<!-- <a> -->
<!--  <xsl:attribute name="href"> -->
<!--   <xsl:variable name="my-section"> -->
<!--    <xsl:choose> -->
<!--     <xsl:when test="@section"> -->
<!--      <xsl:value-of select="@section" /> -->
<!--     </xsl:when> -->
<!--     <xsl:otherwise> -->
<!--      <xsl:text>title</xsl:text> -->
<!--     </xsl:otherwise> -->
<!--    </xsl:choose> -->
<!--   </xsl:variable> -->
<!--   <xsl:variable name="my-series"> -->
      <!-- If series is specified, go one directory back and then to series. Otherwise, add nothing. -->
    <xsl:choose>
     <xsl:when test="@series">
      <xsl:text>/../</xsl:text><xsl:value-of select="@series" />
     </xsl:when>
     <xsl:otherwise>
      <xsl:text></xsl:text>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:variable>
   <xsl:text>..</xsl:text><xsl:value-of select="$my-series" /><xsl:text>/</xsl:text><xsl:value-of select="@book" /><xsl:text>/</xsl:text><xsl:value-of select="$my-section" /><xsl:value-of select="$xhtml-ext"/>
  </xsl:attribute>
  <xsl:if test="@id"><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute></xsl:if>
<!--    <xsl:choose> -->
<!--     <xsl:when test="@series"> -->
<!--      <xsl:text>/../</xsl:text><xsl:value-of select="@series" /> -->
<!--     </xsl:when> -->
<!--     <xsl:otherwise> -->
<!--      <xsl:text></xsl:text> -->
<!--     </xsl:otherwise> -->
<!--    </xsl:choose> -->
<!--   </xsl:variable> -->
<!--   <xsl:text>..</xsl:text><xsl:value-of select="$my-series" /><xsl:text>/</xsl:text><xsl:value-of select="@book" /><xsl:text>/</xsl:text><xsl:value-of select="$my-section" /><xsl:value-of select="$xhtml-ext"/> -->
<!--  </xsl:attribute> -->
<!--  <xsl:if test="@id"><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute></xsl:if> -->
    <xsl:apply-templates />
 </a>
<!-- </a> -->
  </xsl:template>
 
  <xsl:template match="footref">
   <xsl:apply-templates />
   <sup>
-   <a>
-    <xsl:attribute name="href"><xsl:text>#</xsl:text><xsl:value-of select="@idref" /></xsl:attribute>
-    <xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute>
-    <xsl:number count="footref" from="/" level="any" format="1" />
-   </a>
+   <xsl:number count="footref" from="/" level="any" format="1" />
   </sup>
  </xsl:template>
 
@@ -1061,21 +1067,6 @@ is included in all copies.
 
     <body> 
      <div id="body"> 
-      <div id="page-header">
-       <cite>
-        <xsl:apply-templates select="/gamebook/meta/title[1]"/>
-       </cite>
-       <xsl:choose>
-        <xsl:when test="$language='es'">
-         <xsl:text> por </xsl:text>
-        </xsl:when>
-        <xsl:otherwise>
-         <xsl:text> by </xsl:text>
-        </xsl:otherwise>
-       </xsl:choose>
-       <xsl:apply-templates select="/gamebook/meta/creator[@class='short']" />
-      </div>
-
       <xsl:choose>
 
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~ top-level ~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
@@ -1342,7 +1333,7 @@ title of each section be a simple number.
           <p>
            <xsl:for-each select="data/section">
             <xsl:if test="position( ) mod 10 = 1">
-             <b><a><xsl:attribute name="name"><xsl:value-of select="position( ) + $base-section-number" /></xsl:attribute>
+             <b>
               <xsl:value-of select="position( ) + $base-section-number" />
               <xsl:if test="not( position( ) = last( ) )">
                <xsl:text>-</xsl:text>
@@ -1355,7 +1346,7 @@ title of each section be a simple number.
                 </xsl:otherwise>
                </xsl:choose>
               </xsl:if>
-             </a><xsl:text>: </xsl:text></b>
+             <xsl:text>: </xsl:text></b>
             </xsl:if>
             <a>
              <xsl:attribute name="href"><xsl:value-of select="@id" /><xsl:value-of select="$xhtml-ext"/></xsl:attribute>
@@ -1408,7 +1399,7 @@ title of each section be a simple number.
              <p>
               <xsl:text>[</xsl:text>
               <a>
-               <xsl:attribute name="href"><xsl:value-of select="$footnote-section" /><xsl:value-of select="$xhtml-ext"/><xsl:text>#</xsl:text><xsl:value-of select="$footnote-idref" /></xsl:attribute>
+               <xsl:attribute name="href"><xsl:value-of select="$footnote-section" /><xsl:value-of select="$xhtml-ext"/></xsl:attribute>
                <xsl:value-of select="$footnote-marker" />
               </a>
               <xsl:text>] </xsl:text>
@@ -1559,7 +1550,7 @@ title of each section be a simple number.
      <xsl:for-each select="*[1]">
       <p>
        <xsl:text>[</xsl:text>
-        <a href="#{$footnote-idref}" name="{$footnote-id}"><xsl:value-of select="$footnote-marker" /></a>
+        <xsl:value-of select="$footnote-marker" />
        <xsl:text>] </xsl:text>
        <xsl:apply-templates select="child::* | child::text()" />
       </p>