1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet version="1.0"
3 xmlns="http://www.w3.org/1999/xhtml"
4 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5 <xsl:output method="html" omit-xml-declaration="yes" encoding="utf-8" indent="no" />
8 Base tag for rendering a fragment of text
10 <xsl:template match="chunk">
11 <xsl:apply-templates select="child::node()">
12 <xsl:with-param name="mixed" select="true()" />
13 </xsl:apply-templates>
16 <xsl:template match="utwor">
18 <xsl:call-template name="standard-attributes" />
19 <xsl:apply-templates select="child::node()">
20 <xsl:with-param name="mixed" select="false()" />
21 </xsl:apply-templates>
26 <!-- nieedytowany - zawiera bloki -->
27 <xsl:template match="opowiadanie|powiesc|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny|wywiad|nota|nota_red|dedykacja|ramka|lista_osob|dlugi_cytat|poezja_cyt|kwestia|wywiad_pyt|wywiad_odp|motto">
28 <xsl:param name="mixed" />
30 <xsl:call-template name="standard-attributes" />
31 <xsl:apply-templates select="child::node()">
32 <xsl:with-param name="mixed" select="false()" />
33 </xsl:apply-templates>
37 <!-- edytowalny - zawiera tekst -->
38 <xsl:template match="didaskalia|naglowek_podrozdzial|naglowek_osoba|podtytul|naglowek_scena|naglowek_rozdzial|autor_utworu|dzielo_nadrzedne|naglowek_czesc|srodtytul|naglowek_akt|nazwa_utworu|naglowek_listy|lista_osoba|miejsce_czas|akap|akap_cd|akap_dialog|motto_podpis|uwaga|extra">
39 <xsl:param name="mixed" />
40 <div x-editable="true">
41 <xsl:call-template name="standard-attributes" />
42 <xsl:apply-templates select="child::node()">
43 <xsl:with-param name="mixed" select="true()" />
44 </xsl:apply-templates>
48 <xsl:template match="ilustr">
50 <xsl:call-template name="standard-attributes" />
52 <xsl:attribute name="src">
53 <xsl:value-of select="@src" />
56 <p class="alt"><xsl:value-of select="@alt"/></p>
65 <xsl:template match="strofa">
66 <div x-editable="true">
67 <xsl:call-template name="standard-attributes" />
70 <xsl:when test="count(br) > 0">
71 <xsl:variable name="first-verse" select="br[1]/preceding-sibling::node()" />
72 <xsl:call-template name="verse">
73 <xsl:with-param name="verse-content" select="$first-verse" />
75 <xsl:for-each select="br">
76 <xsl:variable name="lnum" select="count(preceding-sibling::br)" />
77 <!-- select all nodes up to the next br or end of stanza -->
78 <xsl:variable name="current-verse"
79 select="following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
80 <xsl:call-template name="verse">
81 <xsl:with-param name="verse-content" select="$current-verse" />
86 <xsl:call-template name="verse">
87 <xsl:with-param name="verse-content" select="child::node()" />
94 <xsl:template name="verse">
95 <!-- the verse contents including the last br (if any) -->
96 <xsl:param name="verse-content" />
97 <xsl:variable name="first-tag-name" select="name($verse-content/self::*)" />
98 <!-- name of text nodes is '' == false -->
100 <!-- THIS IS A HORROR!!! -->
101 <!-- Possible variants: -->
103 <!-- Simple verse == not wers_ tags anywhere until the ending br -->
104 <xsl:when test="not($verse-content[starts-with(name(), 'wers')])">
105 <div class="wers" x-node="wers" x-verse="true" x-auto-node="true">
106 <xsl:apply-templates select="$verse-content[local-name(.) != 'br']">
107 <xsl:with-param name="mixed" select="true()" />
108 </xsl:apply-templates>
113 <xsl:apply-templates select="$verse-content[local-name(.) != 'br']">
114 <xsl:with-param name="mixed" select="false()" />
115 </xsl:apply-templates>
120 <xsl:template match="wers_cd|wers_akap|wers_wciety|wers_do_prawej|wers">
121 <xsl:param name="mixed" />
123 <xsl:call-template name="standard-attributes" />
124 <xsl:apply-templates select="child::node()">
125 <xsl:with-param name="mixed" select="true()" />
126 </xsl:apply-templates>
130 <xsl:template match="br"><xsl:text>/</xsl:text></xsl:template>
132 <!-- Style znakowe -->
133 <xsl:template match="tytul_dziela|wyroznienie|slowo_obce|mat|didask_tekst|osoba|wyp_osoba|www|wieksze_odstepy|indeks_dolny|zastepnik_wersu">
134 <xsl:param name="mixed" />
136 <xsl:call-template name="standard-attributes" />
137 <xsl:apply-templates select="child::node()">
138 <xsl:with-param name="mixed" select="true()" />
139 </xsl:apply-templates>
144 <xsl:template match="sekcja_swiatlo|sekcja_asterysk|separator_linia">
145 <xsl:param name="mixed" />
146 <hr><xsl:call-template name="standard-attributes" /></hr>
149 <!-- Przypisy i motywy -->
150 <xsl:template match="pr|pa|pe|pt">
151 <span x-editable="true">
152 <xsl:call-template name="standard-attributes">
153 <xsl:with-param name="extra-class" select="'annotation-inline-box'" />
155 <a name="anchor-{generate-id(.)}" />
156 <!-- the link to the non-inline version -->
157 <a href="#annotation-{generate-id(.)}" class="annotation"></a>
158 <!-- inline contents -->
159 <span x-annotation-box="true" x-pass-thru="true">
160 <xsl:apply-templates select="node()">
161 <xsl:with-param name="mixed" select="true()" />
162 </xsl:apply-templates>
167 <xsl:template match="ref">
168 <span x-editable="true" x-edit-no-format="true" x-edit-attribute="href">
169 <xsl:call-template name="standard-attributes">
170 <xsl:with-param name="extra-class" select="'reference-inline-box'" />
172 <a class="reference">📌</a>
176 <xsl:template match="begin">
178 <xsl:call-template name="standard-attributes" />
179 <xsl:attribute name="theme-class">
180 <xsl:value-of select="substring-after(@id, 'b')" />
185 <xsl:template match="motyw">
186 <span x-editable="true" x-edit-no-format="true">
187 <xsl:call-template name="standard-attributes" />
188 <xsl:attribute name="theme-class">
189 <xsl:value-of select="substring-after(@id, 'm')" />
191 <span x-pass-thru="true" class="theme-text-list"><xsl:value-of select=".|node()" /></span>
195 <xsl:template match="end">
197 <xsl:call-template name="standard-attributes" />
198 <xsl:attribute name="theme-class">
199 <xsl:value-of select="substring-after(@id, 'e')" />
206 <xsl:template match="text()">
207 <!-- <xsl:value-of select="." /> -->
208 <xsl:param name="mixed" />
210 <xsl:when test="normalize-space(.) = ''">
211 <xsl:value-of select="." />
213 <xsl:when test="not($mixed)">
214 <span x-node="out-of-flow-text" class="out-of-flow-text" x-editable="true">
215 <xsl:value-of select="." />
218 <xsl:otherwise><xsl:value-of select="." /></xsl:otherwise>
222 <xsl:template match="comment()">
223 <xsl:comment><xsl:value-of select="." /></xsl:comment>
226 <xsl:template match="*[name() != local-name()]">
228 <xsl:call-template name="standard-attributes" />
229 <xsl:apply-templates select="child::node()">
230 <xsl:with-param name="mixed" select="true()" />
231 </xsl:apply-templates>
235 <xsl:template match="*">
237 <xsl:call-template name="standard-attributes">
238 <xsl:with-param name="extra-class">unknown-tag</xsl:with-param>
240 <xsl:apply-templates select="child::node()">
241 <xsl:with-param name="mixed" select="true()" />
242 </xsl:apply-templates>
246 <xsl:template name="standard-attributes">
247 <xsl:param name="extra-class" />
248 <xsl:attribute name="class"><xsl:value-of select="local-name()" /><xsl:text> </xsl:text><xsl:value-of select="$extra-class" /></xsl:attribute>
250 <xsl:attribute name="x-node"><xsl:value-of select="local-name()" /></xsl:attribute>
252 <xsl:if test="local-name() != name()">
253 <xsl:attribute name="x-ns"><xsl:value-of select="namespace-uri()" /></xsl:attribute>
256 <xsl:for-each select="@*">
257 <xsl:variable name="id" select="generate-id()" />
258 <xsl:attribute name="x-attr-value-{$id}"><xsl:value-of select="."/></xsl:attribute>
259 <xsl:attribute name="x-attr-name-{$id}"><xsl:value-of select="local-name()"/></xsl:attribute>
261 <xsl:when test="namespace-uri()">
262 <xsl:attribute name="x-attr-ns-{$id}"><xsl:value-of select="namespace-uri()"/></xsl:attribute>
264 <!-- if the element belongs to default namespace and attribut has no namespace -->
265 <xsl:when test="not(namespace-uri(.))">
266 <xsl:attribute name="data-wlf-{local-name()}"><xsl:value-of select="."/></xsl:attribute>
272 <xsl:template match="alien">
273 <span class="alien" x-pass-thru="true">
274 <xsl:apply-templates select="node()">
275 <xsl:with-param name="mixed" select="true()" />
276 </xsl:apply-templates>
280 <xsl:template match="comment()">
281 <xsl:comment><xsl:value-of select="."/></xsl:comment>