Correction to handling line elements
[project-aon.git] / xml / xhtml-mongoose.xsl
index 884d6b3..a08600e 100644 (file)
@@ -9,6 +9,18 @@
 $Id$
 
 $Log$
+Revision 1.5  2007/02/02 20:04:28  jonathan.blake
+Correction to handling line elements
+
+Revision 1.4  2006/12/20 00:15:04  jonathan.blake
+Updated to handle the new capabilities in version 0.12.1 of the Gamebook DTD.
+
+Revision 1.3  2006/12/07 01:42:28  jonathan.blake
+Text illustrations need inclusion
+
+Revision 1.2  2006/11/25 18:57:16  jonathan.blake
+Fixed links to footnotes
+
 Revision 1.1  2006/11/25 04:48:52  jonathan.blake
 Modified to generate a single unstyled, UTF-8, HTML file which lacks any illustrations
 
@@ -539,12 +551,14 @@ Todo:
     <!-- will the list always contain the closest ancestor first? -->
     <xsl:variable name="footnote-section"><xsl:value-of select="ancestor::section[position()=1]/@id" /></xsl:variable>
     <xsl:variable name="footnote-marker"><xsl:number count="footnotes/footnote" from="/" level="any" format="1" /></xsl:variable>
+    <xsl:variable name="footnote-id"><xsl:value-of select="@id" /></xsl:variable>
     <xsl:variable name="footnote-idref"><xsl:text>#</xsl:text><xsl:value-of select="@idref" /></xsl:variable>
      
     <xsl:for-each select="*[1]">
      <p>
       <xsl:text>[</xsl:text>
       <a>
+       <xsl:attribute name="name"><xsl:value-of select="$footnote-id" /></xsl:attribute>
        <xsl:attribute name="href"><xsl:value-of select="$footnote-idref" /></xsl:attribute>
        <xsl:value-of select="$footnote-marker" />
       </a>
@@ -658,11 +672,42 @@ Todo:
 
 <xsl:template match="table">
  <table border="1" cellspacing="0" cellpadding="2">
+  <xsl:if test="@summary"><xsl:attribute name="summary"><xsl:value-of select="@summary" /></xsl:attribute></xsl:if>
   <xsl:apply-templates />
  </table>
  <xsl:value-of select="$newline" />
 </xsl:template>
 
+<xsl:template match="caption">
+ <caption>
+  <xsl:apply-templates />
+ </caption>
+</xsl:template>
+
+<xsl:template match="colgroup[@scope]">
+ <colgroup>
+  <xsl:attribute name="scope"><xsl:value-of select="@scope" /></xsl:attribute>
+ </colgroup>
+</xsl:template>
+
+<xsl:template match="thead">
+ <thead>
+  <xsl:apply-templates />
+ </thead>
+</xsl:template>
+
+<xsl:template match="tfoot">
+ <tfoot>
+  <xsl:apply-templates />
+ </tfoot>
+</xsl:template>
+
+<xsl:template match="tbody">
+ <tbody>
+  <xsl:apply-templates />
+ </tbody>
+</xsl:template>
+
 <xsl:template match="tr">
  <tr>
   <xsl:apply-templates />
@@ -674,6 +719,10 @@ Todo:
   <xsl:if test="@align"><xsl:attribute name="align"><xsl:value-of select="@align" /></xsl:attribute></xsl:if>
   <xsl:if test="@valign"><xsl:attribute name="valign"><xsl:value-of select="@valign" /></xsl:attribute></xsl:if>
   <xsl:if test="@char"><xsl:attribute name="char"><xsl:value-of select="@char" /></xsl:attribute></xsl:if>
+  <xsl:if test="@rowspan"><xsl:attribute name="rowspan"><xsl:value-of select="@rowspan" /></xsl:attribute></xsl:if>
+  <xsl:if test="@colspan"><xsl:attribute name="colspan"><xsl:value-of select="@colspan" /></xsl:attribute></xsl:if>
+  <xsl:if test="@axis"><xsl:attribute name="axis"><xsl:value-of select="@axis" /></xsl:attribute></xsl:if>
+  <xsl:if test="@scope"><xsl:attribute name="scope"><xsl:value-of select="@scope" /></xsl:attribute></xsl:if>
   <xsl:apply-templates />
  </th>
 </xsl:template>
@@ -683,6 +732,10 @@ Todo:
   <xsl:if test="@align"><xsl:attribute name="align"><xsl:value-of select="@align" /></xsl:attribute></xsl:if>
   <xsl:if test="@valign"><xsl:attribute name="valign"><xsl:value-of select="@valign" /></xsl:attribute></xsl:if>
   <xsl:if test="@char"><xsl:attribute name="char"><xsl:value-of select="@char" /></xsl:attribute></xsl:if>
+  <xsl:if test="@rowspan"><xsl:attribute name="rowspan"><xsl:value-of select="@rowspan" /></xsl:attribute></xsl:if>
+  <xsl:if test="@colspan"><xsl:attribute name="colspan"><xsl:value-of select="@colspan" /></xsl:attribute></xsl:if>
+  <xsl:if test="@axis"><xsl:attribute name="axis"><xsl:value-of select="@axis" /></xsl:attribute></xsl:if>
+  <xsl:if test="@scope"><xsl:attribute name="scope"><xsl:value-of select="@scope" /></xsl:attribute></xsl:if>
   <xsl:apply-templates />
  </td>
 </xsl:template>
@@ -847,19 +900,24 @@ Todo:
 </xsl:template>
 
 <xsl:template match="illustration">
- <xsl:if test="instance[@class='html'] and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
-  <xsl:choose>
-   <xsl:when test="@class='float'">
-    <div class="illustration">
-     <xsl:text>[[Illustration </xsl:text>
-     <xsl:number count="illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )]" from="/" level="any" format="I" />
-     <xsl:text>]]</xsl:text>
-    </div><xsl:value-of select="$newline" />
-   </xsl:when>
-
-   <xsl:otherwise></xsl:otherwise>
-  </xsl:choose>
- </xsl:if>
+ <xsl:choose>
+  <xsl:when test="instance[@class='text'] and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
+   <xsl:apply-templates select="instance[@class='text']/*"/>
+  </xsl:when>
+  <xsl:when test="instance[@class='html'] and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
+   <xsl:choose>
+    <xsl:when test="@class='float'">
+     <div class="illustration">
+      <xsl:text>[[Illustration </xsl:text>
+      <xsl:number count="illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )]" from="/" level="any" format="I" />
+      <xsl:text>]]</xsl:text>
+     </div><xsl:value-of select="$newline" />
+    </xsl:when>
+    <xsl:otherwise></xsl:otherwise>
+   </xsl:choose>
+  </xsl:when>
+  <xsl:otherwise></xsl:otherwise>
+ </xsl:choose>
 </xsl:template>
 
 <xsl:template match="instance" />
@@ -1004,6 +1062,11 @@ Todo:
  <tt><xsl:apply-templates /></tt>
 </xsl:template>
 
+<xsl:template match="line">
+ <xsl:apply-templates />
+ <xsl:if test="position( ) != last( )"><br /></xsl:if>
+</xsl:template>
+
 <xsl:template match="br">
  <br />
 </xsl:template>