<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:wl="http://wolnelektury.pl/functions"
xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ exclude-result-prefixes="rdf">
<xsl:output encoding="utf-8" indent="yes" omit-xml-declaration="yes" version="2.0"/>
<xsl:template match="utwor">
</xsl:template>
<xsl:template
- match="dc:title|dc:identifier.url|dc:publisher|dc:rights|dc:rights.license|dc:format|dc:date"
+ match="dc:title|dc:identifier.url|dc:publisher|dc:rights|dc:rights.license|dc:format|dc:date|dc:language|dc:description.material|dc:relation.isPartOf"
mode="meta"/>
<!-- TODO language-dependent: description, audience, requires (subject.competence?) -->
<xsl:template
- match="dc:creator.expert|dc:creator.scenario|dc:creator.textbook|dc:description|dc:subject.curriculum|dc:creator.methodologist|dc:subject.competence|dc:audience|dc:type|dc:requires|dc:language"
+ match="dc:creator.expert|dc:creator.scenario|dc:creator.textbook|dc:description|dc:subject.curriculum|dc:creator.methodologist|dc:subject.competence|dc:audience|dc:type|dc:requires|dc:relation|dc:subject|dc:publisher|dc:date"
mode="meta">
<xsl:copy>
<xsl:apply-templates/>
<xsl:template match="nazwa_utworu">
<header>
- <xsl:apply-templates/>
+ <xsl:apply-templates mode="tekst"/>
</header>
</xsl:template>
<xsl:template match="naglowek_rozdzial">
<section>
- <xsl:if test="./text() = 'Pomysł na lekcję'">
+ <xsl:if test="contains(./text(), 'Pomysł na lekcję')">
<metadata><dc:audience>teacher</dc:audience></metadata>
</xsl:if>
- <header><xsl:apply-templates/></header>
+ <header><xsl:apply-templates mode="tekst"/></header>
<xsl:apply-templates select="key('k_last_header', generate-id())" mode="rozdzial"/>
<xsl:apply-templates select="key('k_rozdzial', generate-id())" mode="rozdzial"/>
</section>
<xsl:template match="naglowek_podrozdzial" mode="rozdzial">
<section>
- <header><xsl:apply-templates/></header>
+ <header><xsl:apply-templates mode="tekst"/></header>
<xsl:apply-templates select="key('k_last_header', generate-id())" mode="rozdzial"/>
</section>
</xsl:template>
</xsl:template>
<xsl:template match="akap" mode="opis">
- <header><xsl:apply-templates mode="tekst"/></header>
+ <header><xsl:number format="1. " count="aktywnosc"/><xsl:apply-templates mode="tekst"/></header>
+ </xsl:template>
+
+ <xsl:template match="opis" mode="rozdzial">
+ <xsl:apply-templates mode="rozdzial"/>
+ </xsl:template>
+
+ <xsl:template match="akap" mode="tekst"><!-- for akap inside punkt -->
+ <xsl:apply-templates select="." mode="rozdzial"/>
+ </xsl:template>
+
+ <xsl:template match="uwaga" mode="rozdzial">
+ <aside class="comment"><xsl:apply-templates mode="tekst"/></aside>
+ </xsl:template>
+ <xsl:template match="uwaga" mode="tekst">
+ <xsl:apply-templates select="." mode="rozdzial"/>
+ </xsl:template>
+ <xsl:template match="uwaga" mode="lista">
+ <div class="item"><xsl:apply-templates select="." mode="rozdzial"/></div>
+ </xsl:template>
+
+ <xsl:template match="text()[normalize-space()]" mode="rozdzial">
+ <div class="p"><xsl:value-of select="normalize-space()"/></div>
</xsl:template>
<xsl:template match="lista" mode="rozdzial">
<div>
<xsl:attribute name="class">
<xsl:choose>
+ <xsl:when test="@typ = 'punkt' or @nazwa or @cel">list</xsl:when>
<xsl:when test="@typ = 'num'">list.enum</xsl:when>
- <xsl:when test="@typ = 'punkt'">list</xsl:when>
+ <xsl:when test="@typ = 'alfa'">list</xsl:when>
<xsl:when test="@typ = 'slowniczek'">list.definitions</xsl:when>
<xsl:when test="@typ = 'czytelnia'">list.bibliography</xsl:when>
</xsl:choose>
</xsl:attribute>
- <xsl:if test="@src != ''">
+ <xsl:if test="@nazwa">
+ <xsl:attribute name="name"><xsl:value-of select="@nazwa"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@cel">
+ <xsl:attribute name="dest"><xsl:value-of select="@cel"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@uchwyty">
+ <xsl:attribute name="handles"><xsl:value-of select="@uchwyty"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@krotkie">
+ <xsl:attribute name="short"><xsl:value-of select="@krotkie"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@src">
<xsl:attribute name="src"><xsl:value-of select="@src"/></xsl:attribute>
</xsl:if>
<xsl:apply-templates mode="lista"/>
</div>
</xsl:template>
+ <xsl:template match="lista" mode="lista">
+ <xsl:apply-templates select="." mode="rozdzial"/>
+ </xsl:template>
+
<xsl:template match="lista" mode="tekst">
<xsl:apply-templates select="." mode="rozdzial"/>
</xsl:template>
<xsl:template match="punkt" mode="lista">
- <div class="item">
- <xsl:apply-templates mode="tekst"/>
- </div>
+ <xsl:choose>
+ <xsl:when test="@rozw">
+ <div class="item.answer">
+ <xsl:attribute name="answer">
+ <xsl:choose>
+ <xsl:when test="@rozw = 'prawda'">true</xsl:when>
+ <xsl:when test="@rozw = 'falsz'">false</xsl:when>
+ <xsl:otherwise><xsl:value-of select="@rozw"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:apply-templates mode="tekst"/>
+ </div>
+ </xsl:when>
+ <xsl:when test="@nazwa">
+ <div class="item.category" name="{@nazwa}">
+ <xsl:apply-templates mode="tekst"/>
+ </div>
+ </xsl:when>
+ <xsl:otherwise>
+ <div class="item">
+ <xsl:apply-templates mode="tekst"/>
+ </div>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:template>
<xsl:template match="definiendum" mode="tekst">
</div>
</xsl:template>
+ <xsl:template match="dlugi_cytat" mode="rozdzial">
+ <div class="important">
+ <xsl:apply-templates mode="rozdzial"/>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="obraz" mode="rozdzial">
+ <div class="img" name="{@nazwa}" alt="{@alt}"/>
+ </xsl:template>
+
+ <xsl:template match="obraz" mode="tekst"><!-- inside punkt -->
+ <xsl:apply-templates select="." mode="rozdzial"/>
+ </xsl:template>
+
+ <xsl:template match="video" mode="rozdzial">
+ <div class="video" src="{@url}"/>
+ </xsl:template>
+
+ <xsl:template match="podpis" mode="rozdzial">
+ <div class="label">
+ <xsl:apply-templates mode="rozdzial"/>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="strofa" mode="tekst">
+ <div class="verse"><xsl:apply-templates mode="tekst"/></div>
+ </xsl:template>
+
+ <!-- aktywnosc -->
+
<xsl:template match="aktywnosc" mode="rozdzial">
<section>
<xsl:apply-templates select="opis/akap[1]" mode="opis"/>
<xsl:apply-templates select="opis/*[position() > 1]" mode="rozdzial"/>
+ <xsl:apply-templates select="akap|lista" mode="rozdzial"/>
<xsl:apply-templates select="wskazowki" mode="rozdzial"/>
<div class="list.definitions">
- <xsl:apply-templates mode="aktywnosc"/>
+ <xsl:apply-templates select="czas|forma|pomoce" mode="aktywnosc"/>
</div>
</section>
</xsl:template>
<div class="item"><div class="defined">Pomoce</div><xsl:apply-templates mode="tekst"/></div>
</xsl:template>
+ <!-- inline elements -->
+
<xsl:template match="link" mode="tekst">
- <div class="link">
+ <span class="link">
<xsl:attribute name="href">
<xsl:choose>
<xsl:when test="@material">
</xsl:choose>
</xsl:attribute>
<xsl:apply-templates mode="tekst"/>
- </div>
+ </span>
</xsl:template>
<xsl:template match="wyroznienie" mode="tekst">
- <div class="emp">
+ <span class="emp">
<xsl:apply-templates mode="tekst"/>
- </div>
+ </span>
</xsl:template>
- <xsl:template match="dlugi_cytat" mode="tekst">
- <div class="cite">
- <xsl:apply-templates mode="tekst"/>
- </div>
+ <xsl:template match="tytul_dziela|slowo_obce" mode="tekst">
+ <span class="cite"><xsl:apply-templates mode="tekst"/></span>
</xsl:template>
<!-- exercises -->
<xsl:template match="cwiczenie" mode="rozdzial">
+ <xsl:choose>
+ <xsl:when test="@typ = 'uporzadkuj'">
+ <div class="exercise.order">
+ <xsl:apply-templates select="opis/*" mode="rozdzial"/>
+ <div class="list.orderable">
+ <xsl:apply-templates select="lista/punkt" mode="lista"/>
+ </div>
+ </div>
+ </xsl:when>
+ <xsl:when test="@typ = 'prawdafalsz'">
+ <div class="exercise.choice.true-or-false">
+ <xsl:apply-templates mode="rozdzial"/>
+ </div>
+ </xsl:when>
+ <xsl:when test="@typ = 'luki'">
+ <div class="exercise.gap">
+ <xsl:apply-templates mode="rozdzial"/>
+ </div>
+ </xsl:when>
+ <xsl:when test="@typ = 'zastap'">
+ <div class="exercise.replace">
+ <xsl:apply-templates mode="rozdzial"/>
+ </div>
+ </xsl:when>
+ <xsl:when test="@typ = 'przyporzadkuj'">
+ <div class="exercise.match">
+ <xsl:apply-templates mode="rozdzial"/>
+ </div>
+ </xsl:when>
+ <xsl:when test="@typ = 'wybor'">
+ <div>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when
+ test="count(.//pytanie) = count(.//punkt[@rozw='prawda']) or (count(.//pytanie) = 0 and count(.//punkt[@rozw='prawda']) = 1)">exercise.choice.single</xsl:when>
+ <xsl:otherwise>exercise.choice</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:apply-templates mode="rozdzial"/>
+ </div>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="luka" mode="tekst">
+ <aside class="gap"><xsl:apply-templates mode="tekst"/></aside>
+ </xsl:template>
+
+ <xsl:template match="zastap" mode="tekst">
+ <span class="answer" answer="{@rozw}"><xsl:apply-templates mode="tekst"/></span>
+ </xsl:template>
+
+ <xsl:template match="pytanie" mode="rozdzial">
+ <div class="question">
+ <xsl:apply-templates mode="rozdzial"/>
+ </div>
+ </xsl:template>
+ <xsl:template match="pytanie" mode="tekst">
+ <xsl:apply-templates select="." mode="rozdzial"/>
+ </xsl:template>
+
+ <xsl:template match="rozw_kom" mode="rozdzial">
+ <div class="solution.comment">
+ <xsl:apply-templates mode="rozdzial"/>
+ </div>
+ </xsl:template>
+ <xsl:template match="rozw_kom" mode="tekst">
+ <xsl:apply-templates select="." mode="rozdzial"/>
+ </xsl:template>
+
+ <!-- table -->
+
+ <xsl:template match="tabela" mode="rozdzial">
+ <div class="table">
+ <xsl:apply-templates mode="tabela"/>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="wiersz" mode="tabela">
+ <div class="table.row">
+ <xsl:apply-templates mode="wiersz"/>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="kol" mode="wiersz">
+ <div class="table.cell">
+ <xsl:apply-templates mode="tekst"/>
+ </div>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wl="http://wolnelektury.pl/functions"
- xmlns:dc="http://purl.org/dc/elements/1.1/">
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ exclude-result-prefixes="wl dc"><!-- nie jestem pewien czy tak ma być -->
<xsl:output encoding="utf-8" indent="yes" omit-xml-declaration = "yes" version="2.0" />
<xsl:template match="section">
<xsl:apply-templates select="metadata" mode="meta" />
- <dc:publisher xml:lang="pl" xmlns:dc="http://purl.org/dc/elements/1.1/">Fundacja Nowoczesna Polska</dc:publisher>
+ <xsl:if test="not(//dc:publisher)">
+ <dc:publisher xml:lang="pl" xmlns:dc="http://purl.org/dc/elements/1.1/">Fundacja Nowoczesna Polska</dc:publisher>
+ </xsl:if>
<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>
<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>
<dc:format xml:lang="pl" xmlns:dc="http://purl.org/dc/elements/1.1/">xml</dc:format>
<!--dc:type xml:lang="pl" xmlns:dc="http://purl.org/dc/elements/1.1/">added-var</dc:type-->
- <dc:date xml:lang="pl" xmlns:dc="http://purl.org/dc/elements/1.1/">2015-01-12</dc:date>
+ <xsl:if test="not(//dc:date)">
+ <dc:date xml:lang="pl" xmlns:dc="http://purl.org/dc/elements/1.1/">2015-01-12</dc:date>
+ </xsl:if>
<!--dc:audience xml:lang="pl" xmlns:dc="http://purl.org/dc/elements/1.1/"><!- -liceum - -><xsl:value-of select="//dc:audience/text()" /></dc:audience-->
<dc:language xml:lang="pl" xmlns:dc="http://purl.org/dc/elements/1.1/">pol</dc:language>
</rdf:Description>
</xsl:template>
<!-- TODO language-dependent: description, audience, requires (subject.competence?) -->
-<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" mode="meta">
+<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">
<xsl:copy><xsl:apply-templates /></xsl:copy>
</xsl:template>
<xsl:if test="@dest">
<xsl:attribute name="cel"><xsl:value-of select="@dest"/></xsl:attribute>
</xsl:if>
+ <xsl:if test="@handles">
+ <xsl:attribute name="uchwyty"><xsl:value-of select="@handles"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@short">
+ <xsl:attribute name="krotkie"><xsl:value-of select="@short"/></xsl:attribute>
+ </xsl:if>
<xsl:apply-templates />
</lista>
</xsl:when>
<lista typ="num"><xsl:apply-templates /></lista>
</xsl:when>
<xsl:when test="@class = 'list.definitions'">
- <xsl:choose>
- <xsl:when test="@src = ''">
- <lista typ="slowniczek"><xsl:apply-templates /></lista>
- </xsl:when>
- <xsl:otherwise>
- <lista typ="slowniczek" src="{@src}"><xsl:apply-templates /></lista>
- </xsl:otherwise>
- </xsl:choose>
+ <lista typ="slowniczek">
+ <xsl:if test="@src">
+ <xsl:attribute name="src"><xsl:value-of select="@src"/></xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates />
+ </lista>
</xsl:when>
<xsl:when test="@class = 'list.bibliography'">
<lista typ="czytelnia"><xsl:apply-templates /></lista>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
+ <xsl:when test="@class = 'img'">
+ <obraz nazwa="{@name}" alt="{@alt}"/>
+ </xsl:when>
+ <xsl:when test="@class = 'video'">
+ <video url="{@src}"/>
+ </xsl:when>
+ <xsl:when test="@class = 'label'">
+ <podpis>
+ <xsl:apply-templates/>
+ </podpis>
+ </xsl:when>
+ <xsl:when test="@class = 'solution.comment'">
+ <rozw_kom>
+ <xsl:apply-templates/>
+ </rozw_kom>
+ </xsl:when>
+ <xsl:when test="@class = 'important'">
+ <dlugi_cytat>
+ <xsl:apply-templates/>
+ </dlugi_cytat>
+ </xsl:when>
<xsl:when test="@class = 'exercise.order'">
<cwiczenie typ="uporzadkuj">
<xsl:call-template name="cwiczenie"/>
</xsl:when>
<xsl:when test="@class = 'exercise.gap'">
<cwiczenie typ="luki">
- <opis><akap>Uzupełnij luki:</akap></opis>
- <xsl:apply-templates/>
+ <xsl:choose>
+ <xsl:when test="div[1]/aside[@class = 'gap']">
+ <opis><akap>Uzupełnij luki:</akap></opis>
+ <xsl:apply-templates/>
+ </xsl:when>
+ <xsl:otherwise>
+ <opis><xsl:apply-templates select="*[1]"/></opis>
+ <xsl:apply-templates select="*[position() > 1]"/>
+ </xsl:otherwise>
+ </xsl:choose>
</cwiczenie>
</xsl:when>
<xsl:when test="@class = 'exercise.replace'">
<cwiczenie typ="zastap">
- <opis><akap>Znajdź i zamień niepasujące słowa w zdaniach na następujące:</akap></opis>
- <xsl:apply-templates/>
+ <xsl:choose>
+ <xsl:when test="div[1]/aside[@class = 'gap']">
+ <opis><akap>Znajdź i zamień niepasujące słowa w zdaniach na następujące:</akap></opis>
+ <xsl:apply-templates/>
+ </xsl:when>
+ <xsl:otherwise>
+ <opis><xsl:apply-templates select="*[1]"/></opis>
+ <xsl:apply-templates select="*[position() > 1]"/>
+ </xsl:otherwise>
+ </xsl:choose>
</cwiczenie>
</xsl:when>
+ <xsl:when test="@class = 'table'">
+ <tabela ramki="0">
+ <xsl:apply-templates/>
+ </tabela>
+ </xsl:when>
+ <xsl:when test="@class = 'table.row'">
+ <wiersz><xsl:apply-templates/></wiersz>
+ </xsl:when>
+ <xsl:when test="@class = 'table.cell'">
+ <kol><xsl:apply-templates/></kol>
+ </xsl:when>
+ <xsl:when test="@class = 'verse'">
+ <strofa><xsl:apply-templates/></strofa>
+ </xsl:when>
<xsl:otherwise>
<NIEZNANY_DIV><xsl:value-of select="@class" /></NIEZNANY_DIV>
</xsl:otherwise>
<xsl:template match="div" mode="opis">
<xsl:choose>
- <xsl:when test="@class = 'p'">
- <akap><xsl:apply-templates /></akap>
- </xsl:when>
- <xsl:when test="@class = 'list'">
- <lista typ="punkt"><xsl:apply-templates /></lista>
- </xsl:when>
- <xsl:when test="@class = 'list.itemized'">
- <lista typ="punkt"><xsl:apply-templates /></lista>
- </xsl:when>
- <xsl:when test="@class = 'item'">
- <punkt><xsl:apply-templates /></punkt>
+ <xsl:when test="@class != 'list.definitions'">
+ <xsl:apply-templates select="." />
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:value-of select="wl:rmext(substring(@href, 8))" />
</xsl:attribute>
</xsl:when>
- <xsl:when test="starts-with(@href, 'http')">
+ <xsl:when test="starts-with(@href, 'http') or starts-with(@href, '#')">
<xsl:attribute name="url">
<xsl:value-of select="@href" />
</xsl:attribute>
<wyroznienie><xsl:apply-templates /></wyroznienie>
</xsl:when>
<xsl:when test="@class = 'cite'">
- <dlugi_cytat><xsl:apply-templates /></dlugi_cytat>
+ <tytul_dziela><xsl:apply-templates /></tytul_dziela>
</xsl:when>
<xsl:when test="@class = 'answer'">
<zastap rozw="{@answer}"><xsl:apply-templates/></zastap>