[jsword-svn] r2330 - trunk/bibledesktop/src/main/resources/xsl/cswing

dmsmith at crosswire.org dmsmith at crosswire.org
Sat Mar 19 09:27:09 MST 2016


Author: dmsmith
Date: 2016-03-19 09:27:09 -0700 (Sat, 19 Mar 2016)
New Revision: 2330

Modified:
   trunk/bibledesktop/src/main/resources/xsl/cswing/simple.xsl
Log:
Improve simple.xslt for styling of tables, notes.

Modified: trunk/bibledesktop/src/main/resources/xsl/cswing/simple.xsl
===================================================================
--- trunk/bibledesktop/src/main/resources/xsl/cswing/simple.xsl	2016-03-19 16:22:27 UTC (rev 2329)
+++ trunk/bibledesktop/src/main/resources/xsl/cswing/simple.xsl	2016-03-19 16:27:09 UTC (rev 2330)
@@ -137,20 +137,25 @@
           SUB.strongs { font-size: 75%; color: red; }
           SUB.morph { font-size: 75%; color: blue; }
           SUB.lemma { font-size: 75%; color: orange; }
-          SUP.verse { font-size: 75%; color: gray; }
-          SUP.note { font-size: 75%; color: green; }
+          .verse { color: gray;}
+          SUP   { font-size: 75%; }
+          .note { color: green; }
+          SUP.note { font-size: 75%; }
+          FONT.note { font-weight: bold;}
           FONT.lex { color: orange; }
           FONT.jesus { color: red; }
           FONT.speech { color: blue; }
           FONT.strike { text-decoration: line-through; }
           FONT.small-caps { font-variant: small-caps; }
+          FONT.spaced-letters { letter-spacing: 1em; }
           FONT.inscription { font-weight: bold; font-variant: small-caps; }
           FONT.divineName { font-variant: small-caps; }
           FONT.normal { font-variant: normal; }
           FONT.caps { text-transform: uppercase; }
-          FONT.catchword { font-weight: bold; }
+          FONT.catchword { font-weight: bold; font-style: italic; }
+          FONT.illuminated { font-weight: bold; font-style: italic; }
           FONT.rdg { font-style: italic; }
-          H1 { font-size: 115%; font-weight: bold; }
+          H1 { font-size: 130%; font-weight: bold; }
           H2 { font-size: 110%; font-weight: bold; }
           H3 { font-size: 100%; font-weight: bold; }
           H4 { font-size:  90%; font-weight: bold; }
@@ -159,8 +164,8 @@
           .heading { color: #669966; text-align: center; }
           .canonical { color: #666699; text-align: center; }
           .gen { color: #996666; }
-          div.margin { font-size:90%; }
-          TABLE { width:100% }
+          DIV.margin { font-size: 90%; }
+          TABLE { width:100%; }
           TD.notes { width:20%; background:#f4f4e8; }
           TD.text { width:80%; }
           <!-- the following are for dictionary entries -->
@@ -179,7 +184,7 @@
           <xsl:when test="$Notes = 'true' and //note[not(@type = 'x-strongsMarkup')]">
             <xsl:choose>
               <xsl:when test="$direction != 'rtl'">
-                <table cols="2" cellpadding="5" cellspacing="5">
+                <table cols="2" cellpadding="10" cellspacing="0">
                   <tr>
                     <!-- The two rows are swapped until the bug is fixed. -->
                     <td valign="top" class="notes">
@@ -194,7 +199,7 @@
               </xsl:when>
               <xsl:otherwise>
                 <!-- reverse the table for Right to Left languages -->
-                <table cols="2" cellpadding="5" cellspacing="5">
+                <table cols="2" cellpadding="10" cellspacing="0">
                   <!-- In a right to left, the alignment should be reversed too -->
                   <tr align="right">
                     <td valign="top" class="text">
@@ -360,7 +365,7 @@
         <xsl:call-template name="versenum"/><xsl:apply-templates/>
         <!-- Follow the verse with an extra space -->
         <!-- when they don't start on lines to themselves -->
-        <xsl:text> </xsl:text>
+        <xsl:text>&#160;&#160;</xsl:text>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>
@@ -394,7 +399,7 @@
         <xsl:call-template name="versenum"/><xsl:apply-templates mode="jesus"/>
         <!-- Follow the verse with an extra space -->
         <!-- when they don't start on lines to themselves -->
-        <xsl:text> </xsl:text>
+        <xsl:text>&#160;&#160;</xsl:text>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>
@@ -450,16 +455,16 @@
         -->
       <xsl:choose>
         <xsl:when test="$TinyVNum = 'true' and $Notes = 'true'">
-          <a name="{@osisID}"><sup class="verse"><font><xsl:value-of select="$versenum"/></font></sup></a><xsl:text> </xsl:text>
+          <a name="{@osisID}"><font class="verse"><sup><xsl:value-of select="$versenum"/></sup></font></a><xsl:text>&#160;</xsl:text>
         </xsl:when>
         <xsl:when test="$TinyVNum = 'true' and $Notes = 'false'">
-          <sup class="verse"><font><xsl:value-of select="$versenum"/></font></sup><xsl:text> </xsl:text>
+          <font class="verse"><sup><xsl:value-of select="$versenum"/></sup></font><xsl:text>&#160;</xsl:text>
         </xsl:when>
         <xsl:when test="$TinyVNum = 'false' and $Notes = 'true'">
-          <a name="{@osisID}">(<font><xsl:value-of select="$versenum"/></font>)</a><xsl:text> </xsl:text>
+          <a name="{@osisID}"><font class="verse">(<xsl:value-of select="$versenum"/>)</font></a><xsl:text>&#160;</xsl:text>
         </xsl:when>
         <xsl:otherwise>
-          (<font><xsl:value-of select="$versenum"/></font>)<xsl:text> </xsl:text>
+          <font class="verse">(<xsl:value-of select="$versenum"/>)</font><xsl:text>&#160;</xsl:text>
         </xsl:otherwise>
       </xsl:choose>
     </xsl:if>
@@ -519,7 +524,7 @@
   <!--=======================================================================-->
   <xsl:template match="note" mode="print-notes">
     <div class="margin">
-      <strong><xsl:call-template name="generateNoteXref"/></strong>
+      <font class="note"><xsl:call-template name="generateNoteXref"/></font>
       <a name="note-{generate-id(.)}">
         <xsl:text> </xsl:text>
       </a>
@@ -871,6 +876,13 @@
         <xsl:when test="@level = '6'">
           <h6 class="{$heading}"><xsl:apply-templates/></h6>
         </xsl:when>
+        <!-- Level supercedes type -->
+        <xsl:when test="@type = 'main'">
+          <h1 class="{$heading}"><xsl:apply-templates/></h1>
+        </xsl:when>
+        <xsl:when test="@type = 'chapter'">
+          <h2 class="{$heading}"><xsl:apply-templates/></h2>
+        </xsl:when>
         <xsl:otherwise>
           <h3 class="{$heading}"><xsl:apply-templates /></h3>
         </xsl:otherwise>
@@ -1332,7 +1344,8 @@
 
   <xsl:template match="table">
     <table class="table">
-      <xsl:copy-of select="@rows|@cols"/>
+      <xsl:copy-of select="@rows|@cols|@border"/>
+      <xsl:attribute name="cellspacing">0</xsl:attribute>
       <xsl:if test="head">
         <thead class="head"><xsl:apply-templates select="head"/></thead>
       </xsl:if>
@@ -1430,7 +1443,7 @@
         <em><xsl:apply-templates/></em>
       </xsl:when>
       <xsl:when test="$style = 'illuminated'">
-        <strong><em><xsl:apply-templates/></em></strong>
+        <font class="illuminated"><xsl:apply-templates/></font>
       </xsl:when>
       <xsl:when test="$style = 'italic'">
         <em><xsl:apply-templates/></em>
@@ -1444,6 +1457,9 @@
       <xsl:when test="$style = 'small-caps'">
         <font class="small-caps"><xsl:apply-templates mode="small-caps"/></font>
       </xsl:when>
+      <xsl:when test="$style = 'spaced-letters'">
+        <font class="spaced-letters"><xsl:call-template name="spaced-letters"><xsl:with-param name="text" select="text()"/></xsl:call-template></font>
+      </xsl:when>
       <xsl:when test="$style = 'sub'">
         <sub><xsl:apply-templates/></sub>
       </xsl:when>
@@ -1578,6 +1594,16 @@
     <xsl:value-of select="translate(., 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
   </xsl:template>
 
+  <xsl:template name="spaced-letters">
+    <xsl:param name="text"/>
+    <xsl:value-of select="substring($text,1,1)"/>
+    <xsl:if test="string-length($text) > 1">
+      <xsl:text>&#160;</xsl:text>
+      <xsl:call-template name="spaced-letters"><xsl:with-param name="text" select="substring($text,2)"/>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+
   <!--
     Generate a css or an inline style representation of a font spec.
     The fontspec that is passed in is in one of two forms:




More information about the jsword-svn mailing list