1 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
2 xmlns:wl="http://wolnelektury.pl/functions" >
4 <xsl:output method="xml" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.1//EN" doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" indent="yes" />
6 <xsl:template match="text()" />
7 <xsl:template match="text()" mode="inline">
8 <xsl:value-of select="wl:substitute_entities(.)" />
11 <xsl:template match="extra|uwaga" />
12 <xsl:template match="extra|uwaga" mode="inline" />
14 <xsl:template match="utwor">
17 <title>book2html output</title>
18 <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
19 <link rel="stylesheet" href="master.css" type="text/css" media="all" charset="utf-8" />
22 <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" />
23 <xsl:if test="count(descendant::*[self::pe or self::pa or self::pr or self::pt][not(parent::extra)])">
26 <xsl:for-each select="descendant::*[self::pe or self::pa or self::pr or self::pt][not(parent::extra)]">
28 <a name="{concat('footnote-', generate-id(.))}" />
29 <a href="{concat('#anchor-', generate-id(.))}" class="annotation">[<xsl:number value="count(preceding::*[self::pa or self::pe or self::pr or self::pt]) + 1" />]</a>
31 <xsl:when test="count(akap|akap_cd|strofa) = 0">
32 <p><xsl:apply-templates select="text()|*" mode="inline" /></p>
35 <xsl:apply-templates select="text()|*" mode="inline" />
47 <xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny">
48 <xsl:if test="nazwa_utworu">
50 <xsl:apply-templates select="autor_utworu|dzielo_nadrzedne|nazwa_utworu" mode="header" />
53 <xsl:apply-templates />
56 <xsl:template match="autor_utworu" mode="header">
57 <span class="author"><xsl:apply-templates mode="inline" /></span>
60 <xsl:template match="nazwa_utworu" mode="header">
61 <span class="title"><xsl:apply-templates mode="inline" /></span>
64 <xsl:template match="dzielo_nadrzedne" mode="header">
65 <span class="collection"><xsl:apply-templates mode="inline" /></span>
68 <xsl:template match="naglowek_akt|naglowek_czesc|srodtytul">
69 <h2><xsl:apply-templates mode="inline" /></h2>
72 <xsl:template match="naglowek_scena|naglowek_rozdzial">
73 <h3><xsl:apply-templates mode="inline" /></h3>
76 <xsl:template match="naglowek_osoba">
77 <h4><xsl:apply-templates mode="inline" /></h4>
80 <xsl:template match="kwestia">
82 <xsl:apply-templates select="strofa|akap" />
86 <xsl:template match="didaskalia">
87 <div class="didaskalia"><xsl:apply-templates mode="inline" /></div>
90 <xsl:template match="lista_osob">
91 <div class="person-list">
92 <h3><xsl:value-of select="naglowek_listy" /></h3>
94 <xsl:apply-templates select="lista_osoba" />
99 <xsl:template match="lista_osoba">
100 <li><xsl:apply-templates mode="inline" /></li>
103 <xsl:template match="begin" mode="inline">
104 <xsl:variable name="mnum" select="concat('m', substring(@id, 2))" />
105 <span class="theme-begin" fid="{substring(@id, 2)}">
106 <xsl:value-of select="string(following::motyw[@id=$mnum]/text())" />
110 <xsl:template match="end" mode="inline">
111 <span class="theme-end" fid="{substring(@id, 2)}"> </span>
114 <xsl:template match="begin|end">
115 <xsl:apply-templates select='.' mode="inline" />
118 <xsl:template name="verse">
119 <xsl:param name="line-content" />
120 <xsl:param name="line-number" />
123 <xsl:when test="name($line-content) = 'wers_akap'">
124 <xsl:attribute name="style">indent: 1em</xsl:attribute>
126 <xsl:when test="name($line-content) = 'wers_wciety'">
127 <xsl:attribute name="style">indent: 2em</xsl:attribute>
130 <xsl:apply-templates select="$line-content" mode="inline" />
134 <xsl:template match="pa|pe|pr|pt" mode="inline">
135 <a name="{concat('anchor-', generate-id(.))}" />
136 <a href="{concat('#footnote-', generate-id(.))}" class="annotation">[<xsl:number value="count(preceding::*[self::pa or self::pe or self::pr or self::pt]) + 1" />]</a>
139 <xsl:template match="strofa">
142 <xsl:when test="count(br) > 0">
143 <xsl:call-template name="verse">
144 <xsl:with-param name="line-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
145 <xsl:with-param name="line-number" select="1" />
147 <xsl:for-each select="br">
148 <!-- Każdy BR "zjada" to co jest za nim -->
149 <xsl:variable name="lnum" select="count(preceding-sibling::br)" />
150 <xsl:call-template name="verse">
151 <xsl:with-param name="line-number" select="$lnum+2" />
152 <xsl:with-param name="line-content"
153 select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
158 <xsl:call-template name="verse">
159 <xsl:with-param name="line-content" select="text() | node()" />
160 <xsl:with-param name="line-number" select="1" />
167 <xsl:template match="akap|akap_dialog|akap_cd">
168 <p class="paragraph"><xsl:apply-templates mode="inline" /></p>
171 <xsl:template match="motyw" mode="inline" />
173 <xsl:template match="dlugi_cytat">
174 <blockquote><xsl:apply-templates /></blockquote>
177 <xsl:template match="motto">
178 <p class="motto"><xsl:apply-templates mode="inline" /></p>
181 <xsl:template match="sekcja_swiatlo">
182 <hr class="spacer" />