1 <?xml version="1.0" encoding="utf-8"?>
2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:wl="http://wolnelektury.pl/functions"
4 xmlns:dc="http://purl.org/dc/elements/1.1/"
5 exclude-result-prefixes="wl dc"><!-- nie jestem pewien czy tak ma być -->
6 <xsl:output encoding="utf-8" indent="yes" omit-xml-declaration = "yes" version="2.0" />
8 <xsl:template match="section">
10 <xsl:when test="not(ancestor::*)">
11 <utwor xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:wl="http://wolnelektury.pl/functions">
12 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
14 <xsl:attribute name="rdf:about">
15 <xsl:text>http://redakcja.edukacjamedialna.edu.pl/documents/book/</xsl:text>
16 <xsl:value-of select="@redslug" />
17 <xsl:text>/</xsl:text>
19 <dc:title xml:lang="pl" xmlns:dc="http://purl.org/dc/elements/1.1/"><xsl:apply-templates select="header/text()" /></dc:title>
20 <dc:identifier.url xml:lang="pl" xmlns:dc="http://purl.org/dc/elements/1.1/">
21 <xsl:text>http://edukacjamedialna.edu.pl/lekcje/</xsl:text>
22 <xsl:value-of select="@wlslug" />
23 <xsl:text>/</xsl:text>
26 <!--dc:creator.expert xml:lang="pl" ></dc:creator.expert>
27 <dc:creator.methodologist xml:lang="pl" xmlns:dc="http://purl.org/dc/elements/1.1/"></dc:creator.methodologist>
28 <dc:creator.scenario xml:lang="pl" xmlns:dc="http://purl.org/dc/elements/1.1/"></dc:creator.scenario>
29 <dc:creator.textbook xml:lang="pl" xmlns:dc="http://purl.org/dc/elements/1.1/"></dc:creator.textbook-->
31 <xsl:apply-templates select="metadata" mode="meta" />
33 <xsl:if test="not(/section/metadata/dc:publisher)">
34 <dc:publisher xml:lang="pl" xmlns:dc="http://purl.org/dc/elements/1.1/">Fundacja Nowoczesna Polska</dc:publisher>
36 <dc:rights xml:lang="pl" xmlns:dc="http://purl.org/dc/elements/1.1/">Creative Commons Uznanie autorstwa - Na tych samych warunkach 3.0</dc:rights>
37 <dc:rights.license xml:lang="pl" xmlns:dc="http://purl.org/dc/elements/1.1/">http://creativecommons.org/licenses/by-sa/3.0/</dc:rights.license>
38 <dc:format xml:lang="pl" xmlns:dc="http://purl.org/dc/elements/1.1/">xml</dc:format>
39 <!--dc:type xml:lang="pl" xmlns:dc="http://purl.org/dc/elements/1.1/">added-var</dc:type-->
40 <xsl:if test="not(/section/metadata/dc:date)">
41 <dc:date xml:lang="pl" xmlns:dc="http://purl.org/dc/elements/1.1/">2015-01-12</dc:date>
43 <!--dc:audience xml:lang="pl" xmlns:dc="http://purl.org/dc/elements/1.1/"><!- -liceum - -><xsl:value-of select="//dc:audience/text()" /></dc:audience-->
44 <dc:language xml:lang="pl" xmlns:dc="http://purl.org/dc/elements/1.1/">pol</dc:language>
48 <xsl:apply-templates />
52 <xsl:when test="count(ancestor::*) = 3">
54 <opis><xsl:apply-templates select="header" /><xsl:apply-templates select="div" mode="opis" /></opis>
55 <xsl:apply-templates select="div" mode="aktywnosc" />
56 <xsl:apply-templates select="section" mode="error" />
59 <xsl:otherwise><xsl:apply-templates /></xsl:otherwise>
63 <!-- TODO language-dependent: description, audience, requires (subject.competence?) -->
64 <xsl:template match="dc:creator.expert|dc:creator.scenario|dc:creator.textbook|dc:description|dc:subject.curriculum|dc:subject.curriculum.new|dc:creator.methodologist|dc:subject.competence|dc:audience|dc:type|dc:requires|dc:relation|dc:subject|dc:date|dc:publisher" mode="meta">
65 <xsl:copy><xsl:apply-templates /></xsl:copy>
68 <xsl:template match="metadata"/>
69 <xsl:template match="aside">
70 <xsl:if test="@class = 'gap'">
71 <luka><xsl:apply-templates/></luka>
76 <xsl:template match="header">
78 <xsl:when test="count(ancestor::*) = 1">
79 <nazwa_utworu><xsl:apply-templates /></nazwa_utworu>
81 <xsl:when test="count(ancestor::*) = 2">
82 <naglowek_rozdzial><xsl:apply-templates /></naglowek_rozdzial>
84 <xsl:when test="count(ancestor::*) = 3">
85 <naglowek_podrozdzial><xsl:apply-templates /></naglowek_podrozdzial>
87 <xsl:when test="count(ancestor::*) = 4">
88 <akap><xsl:apply-templates /></akap>
94 <xsl:template match="div">
96 <xsl:when test="@class = 'p'">
97 <akap><xsl:apply-templates /></akap>
99 <xsl:when test="@class = 'list'">
101 <xsl:if test="@name">
102 <xsl:attribute name="nazwa"><xsl:value-of select="@name"/></xsl:attribute>
104 <xsl:if test="@dest">
105 <xsl:attribute name="cel"><xsl:value-of select="@dest"/></xsl:attribute>
107 <xsl:if test="@handles">
108 <xsl:attribute name="uchwyty"><xsl:value-of select="@handles"/></xsl:attribute>
110 <xsl:if test="@short">
111 <xsl:attribute name="krotkie"><xsl:value-of select="@short"/></xsl:attribute>
113 <xsl:apply-templates />
116 <xsl:when test="@class = 'list.itemized'">
117 <lista typ="punkt"><xsl:apply-templates /></lista>
119 <xsl:when test="@class = 'list.orderable'">
120 <lista typ="punkt"><xsl:apply-templates /></lista>
122 <xsl:when test="@class = 'list.enum'">
123 <lista typ="num"><xsl:apply-templates /></lista>
125 <xsl:when test="@class = 'list.definitions'">
126 <lista typ="slowniczek">
128 <xsl:attribute name="src"><xsl:value-of select="@src"/></xsl:attribute>
130 <xsl:apply-templates />
133 <xsl:when test="@class = 'list.bibliography'">
134 <lista typ="czytelnia"><xsl:apply-templates /></lista>
136 <xsl:when test="@class = 'item'">
137 <punkt><xsl:apply-templates /></punkt>
139 <xsl:when test="@class = 'item.category'">
140 <punkt nazwa="{@name}"><xsl:apply-templates /></punkt>
142 <xsl:when test="@class = 'item.answer'">
144 <xsl:attribute name="rozw">
146 <xsl:when test="@answer = 'true'">prawda</xsl:when>
147 <xsl:when test="@answer = 'false'">falsz</xsl:when>
148 <xsl:otherwise><xsl:value-of select="@answer" /></xsl:otherwise>
151 <xsl:apply-templates />
154 <xsl:when test="@class = 'question'">
156 <xsl:for-each select="div">
158 <xsl:when test="@class = 'p'">
159 <xsl:apply-templates />
162 <xsl:apply-templates select="."/>
168 <xsl:when test="@class = 'defined'">
170 <xsl:when test="count(ancestor::*) = 4 ">
171 <definiendum><xsl:apply-templates /></definiendum>
177 <xsl:when test="@class = 'img'">
178 <obraz nazwa="{@name}" alt="{@alt}"/>
180 <xsl:when test="@class = 'video'">
181 <video url="{@src}"/>
183 <xsl:when test="@class = 'label'">
185 <xsl:apply-templates/>
188 <xsl:when test="@class = 'solution.comment'">
190 <xsl:apply-templates/>
193 <xsl:when test="@class = 'important'">
195 <xsl:apply-templates/>
198 <xsl:when test="@class = 'exercise.order'">
199 <cwiczenie typ="uporzadkuj">
200 <xsl:call-template name="cwiczenie"/>
203 <xsl:when test="@class = 'exercise.choice.true-or-false'">
204 <cwiczenie typ="prawdafalsz">
205 <xsl:call-template name="cwiczenie"/>
208 <xsl:when test="@class = 'exercise.choice' or @class = 'exercise.choice.single'">
209 <cwiczenie typ="wybor">
210 <xsl:call-template name="cwiczenie"/>
213 <xsl:when test="@class = 'exercise.match'">
214 <cwiczenie typ="przyporzadkuj">
215 <xsl:call-template name="cwiczenie"/>
218 <xsl:when test="@class = 'exercise.gap'">
219 <cwiczenie typ="luki">
221 <xsl:when test="div[1]/aside[@class = 'gap']">
222 <opis><akap>Uzupełnij luki:</akap></opis>
223 <xsl:apply-templates/>
226 <opis><xsl:apply-templates select="*[1]"/></opis>
227 <xsl:apply-templates select="*[position() > 1]"/>
232 <xsl:when test="@class = 'exercise.replace'">
233 <cwiczenie typ="zastap">
235 <xsl:when test="div[1]/aside[@class = 'gap']">
236 <opis><akap>Znajdź i zamień niepasujące słowa w zdaniach na następujące:</akap></opis>
237 <xsl:apply-templates/>
240 <opis><xsl:apply-templates select="*[1]"/></opis>
241 <xsl:apply-templates select="*[position() > 1]"/>
246 <xsl:when test="@class = 'table'">
248 <xsl:apply-templates/>
251 <xsl:when test="@class = 'table.row'">
252 <wiersz><xsl:apply-templates/></wiersz>
254 <xsl:when test="@class = 'table.cell'">
255 <kol><xsl:apply-templates/></kol>
257 <xsl:when test="@class = 'verse'">
258 <strofa><xsl:apply-templates/></strofa>
261 <NIEZNANY_DIV><xsl:value-of select="@class" /></NIEZNANY_DIV>
266 <xsl:template match="div" mode="opis">
268 <xsl:when test="@class != 'list.definitions'">
269 <xsl:apply-templates select="." />
274 <xsl:template match="div" mode="aktywnosc">
276 <xsl:when test="@class = 'list.definitions'">
277 <xsl:apply-templates mode="defs" />
283 <xsl:template match="div" mode="defs">
285 <xsl:when test="div/text() = 'Czas'"><czas><xsl:apply-templates /></czas></xsl:when>
286 <xsl:when test="div/text() = 'Metoda'"><forma><xsl:apply-templates /></forma></xsl:when>
287 <xsl:when test="div/text() = 'Pomoce'"><pomoce><xsl:apply-templates /></pomoce></xsl:when>
291 <xsl:template match="span">
293 <xsl:when test="@class = 'link'">
296 <xsl:when test="starts-with(@href, 'file://')">
297 <xsl:attribute name="material">
298 <xsl:value-of select="wl:rmext(substring(@href, 8))" />
301 <xsl:when test="starts-with(@href, 'http') or starts-with(@href, '#')">
302 <xsl:attribute name="url">
303 <xsl:value-of select="@href" />
307 <xsl:attribute name="url">
308 <xsl:value-of select="." />
312 <xsl:apply-templates />
315 <xsl:when test="@class = 'emp'">
316 <wyroznienie><xsl:apply-templates /></wyroznienie>
318 <xsl:when test="@class = 'cite'">
319 <tytul_dziela><xsl:apply-templates /></tytul_dziela>
321 <xsl:when test="@class = 'answer'">
322 <zastap rozw="{@answer}"><xsl:apply-templates/></zastap>
325 <NIEZNANY_SPAN><xsl:value-of select="@class" /></NIEZNANY_SPAN>
330 <xsl:template match="section" mode="error">
334 <xsl:template name="cwiczenie">
335 <xsl:for-each select="div">
337 <xsl:when test="@class = 'p'">
338 <opis><xsl:apply-templates select="."/></opis>
339 <!-- https://stackoverflow.com/questions/27374493/grouping-the-consecutive-elements-in-xslt -->
342 <xsl:apply-templates select="."/>