Skip to content

Commit

Permalink
FB2: a few more elements.
Browse files Browse the repository at this point in the history
  • Loading branch information
mgorny committed May 6, 2012
1 parent bff2d05 commit 1168ecb
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
27 changes: 22 additions & 5 deletions librarian/fb2/fb2.xslt
Expand Up @@ -33,29 +33,46 @@
<xsl:template match="dc:*" mode="outer">
</xsl:template>

<!-- we can't handle lyrics nicely yet -->
<xsl:template match="powiesc|opowiadanie" mode="outer">
<body> <!-- main body for main book flow -->
<xsl:if test="autor_utworu or nazwa_utworu">
<title>
<xsl:apply-templates mode="title"
select="autor_utworu|nazwa_utworu"/>
select="autor_utworu|dzielo_nadrzedne|nazwa_utworu"/>
</title>
</xsl:if>

<xsl:variable name="sections" select="count(naglowek_rozdzial)"/>
<section>
<xsl:apply-templates mode="para"
select="*[count(following-sibling::naglowek_rozdzial)
= $sections]"/>
<xsl:choose>
<xsl:when test="local-name() = 'liryka_l'">
<poem>
<xsl:apply-templates mode="poem"/>
</poem>
</xsl:when>

<xsl:otherwise>
<xsl:apply-templates mode="para"
select="*[count(following-sibling::naglowek_rozdzial)
= $sections]"/>
</xsl:otherwise>
</xsl:choose>
</section>

<xsl:apply-templates mode="sections"/>
</body>
</xsl:template>

<xsl:template mode="title" match="autor_utworu|nazwa_utworu">
<xsl:template match="uwaga" mode="outer"/>
<xsl:template match="extra" mode="outer"/>

<xsl:template mode="title" match="*">
<!-- title -->

<p><xsl:apply-templates mode="inline"/></p>
</xsl:template>

<xsl:template match="uwaga" mode="title"/>
<xsl:template match="extra" mode="title"/>
</xsl:stylesheet>
3 changes: 3 additions & 0 deletions librarian/fb2/inline.xslt
Expand Up @@ -32,4 +32,7 @@
<xsl:template match="text()" mode="inline">
<xsl:value-of select="wl:substitute_entities(.)"/>
</xsl:template>

<xsl:template match="uwaga" mode="inline"/>
<xsl:template match="extra" mode="inline"/>
</xsl:stylesheet>
2 changes: 2 additions & 0 deletions librarian/fb2/poems.xslt
Expand Up @@ -58,4 +58,6 @@
</xsl:call-template>
</xsl:if>
</xsl:template>

<xsl:template match="text()" mode="poem"/>
</xsl:stylesheet>
3 changes: 2 additions & 1 deletion librarian/fb2/sections.xslt
Expand Up @@ -12,9 +12,10 @@
xmlns:l="http://www.w3.org/1999/xlink">

<!-- a nice epigraph section -->
<xsl:template match="nota_red" mode="sections">
<xsl:template match="dedykacja|nota|nota_red" mode="sections">
<epigraph>
<xsl:apply-templates mode="para"/>
<!-- XXX: <strofa/> can be here as well -->
</epigraph>
</xsl:template>

Expand Down

0 comments on commit 1168ecb

Please sign in to comment.