Fix font-optimizer for Perl 5.18.
[librarian.git] / librarian / xslt / book2html.xslt
old mode 100755 (executable)
new mode 100644 (file)
index eac63a7..778202e
     <div class="dedication"><xsl:apply-templates /></div>
 </xsl:template>
 
+<xsl:template match="ramka">
+    <div class="frame"><xsl:apply-templates /></div>
+</xsl:template>
+
 <xsl:template match="kwestia">
     <div class="kwestia">
         <xsl:apply-templates select="strofa|akap|didaskalia" />
 </xsl:template>
 
 
+<xsl:template match="tabela">
+    <table><xsl:apply-templates /></table>
+</xsl:template>
+<xsl:template match="wiersz">
+    <tr><xsl:apply-templates /></tr>
+</xsl:template>
+<xsl:template match="kol">
+    <td><xsl:apply-templates mode="inline" /></td>
+</xsl:template>
+
+<xsl:template match="ilustr" mode="inline">
+    <xsl:apply-templates select="."/>
+</xsl:template>
+
+<xsl:template match="ilustr">
+    <img>
+        <xsl:attribute name="src">
+            <xsl:value-of select="@src" />
+        </xsl:attribute>
+                <xsl:attribute name="alt">
+                            <xsl:value-of select="@alt" />
+                                    </xsl:attribute>
+                                <xsl:attribute name="title">
+                                                            <xsl:value-of select="@alt" />
+                                                                                                </xsl:attribute>
+
+
+    </img>
+</xsl:template>
+<xsl:template match="lista[@typ='num']">
+    <ol><xsl:apply-templates /></ol>
+</xsl:template>
+<xsl:template match="lista[@typ='punkt']">
+    <ul><xsl:apply-templates /></ul>
+    </xsl:template>
+<xsl:template match="punkt">
+    <li><xsl:apply-templates mode="inline" /></li>
+        </xsl:template>
+
+
+
+
+
 <!-- ========================================== -->
 <!-- = PARAGRAPH TAGS                         = -->
 <!-- = (can contain inline and special tags)  = -->
 </xsl:template>
 
 <!-- Section headers (included in index)-->
-<xsl:template match="naglowek_akt|naglowek_czesc|srodtytul">
-    <h2><xsl:apply-templates mode="inline" /></h2>
+<xsl:template match="naglowek_akt|naglowek_czesc">
+  <xsl:call-template name="section-anchor"/>
+    <h2>
+        <xsl:apply-templates mode="inline" /></h2>
 </xsl:template>
 
 <xsl:template match="naglowek_scena|naglowek_rozdzial">
+    <xsl:call-template name="section-anchor"/>
     <h3><xsl:apply-templates mode="inline" /></h3>
 </xsl:template>
 
 <xsl:template match="naglowek_osoba|naglowek_podrozdzial">
+      <xsl:call-template name="section-anchor"/>
     <h4><xsl:apply-templates mode="inline" /></h4>
 </xsl:template>
 
+<xsl:template match="srodtytul">
+  <xsl:call-template name="section-anchor"/>
+      <h5>
+                                          <xsl:apply-templates mode="inline" /></h5>
+                                          </xsl:template>
+
+
 <!-- Other paragraph tags -->
 <xsl:template match="miejsce_czas">
+      <xsl:call-template name="section-anchor"/>
     <p class="place-and-time"><xsl:apply-templates mode="inline" /></p>
 </xsl:template>
 
 <xsl:template match="didaskalia">
+      <xsl:call-template name="section-anchor"/>
     <div class="didaskalia"><xsl:apply-templates mode="inline" /></div>
 </xsl:template>
 
 
 <xsl:template match="akap|akap_dialog|akap_cd">
     <p class="paragraph">
-        <a name="{concat('sect', position())}" />
+      <xsl:call-template name="section-anchor"/>
        <xsl:apply-templates mode="inline" />
     </p>
 </xsl:template>
 
 <xsl:template match="strofa">
     <div class="stanza">
-      <a name="{concat('sect', position())}" />
+      <xsl:call-template name="section-anchor"/>
         <xsl:choose>
             <xsl:when test="count(br) > 0">
                 <xsl:call-template name="verse">
     <em class="person"><xsl:apply-templates mode="inline" /></em>
 </xsl:template>
 
+<xsl:template match="www" mode="inline">
+    <a>
+        <xsl:attribute name="href">
+            <xsl:value-of select="text()"/>
+        </xsl:attribute>
+        <xsl:value-of select="text()"/>
+    </a>
+</xsl:template>
 
 <!-- ============================================== -->
 <!-- = STANDALONE TAGS                            = -->
     <xsl:value-of select="wl:substitute_entities(.)" />
 </xsl:template>
 
+<!-- ========= -->
+<!-- = utils = -->
+<!-- ========= -->
+<xsl:template name="section-anchor">
+  <!-- 
+       this formula works as follows:
+       - get all ancestors including self
+       - choose the header (third one from root): utwor/book-type/header
+       - get all preceding siblings
+       - count them
+       - create an <a name="sec123"/> tag.
+  -->
+        <a name="{concat('sec', count(ancestor-or-self::*[last()-2]/preceding-sibling::*) + 1)}" />
+</xsl:template>
 
 </xsl:stylesheet>