<xsl:output encoding="utf-8" indent="yes" version="2.0" />
-
<xsl:template match="utwor">
<TeXML xmlns="http://getfo.sourceforge.net/texml/ns1">
<TeXML escape="0">
\documentclass[a4paper, oneside, 11pt]{book}
- \usepackage[MeX]{polski}
- \usepackage[utf8]{inputenc}
- \pagestyle{plain}
- \usepackage{antpolt}
- \usepackage[bottom]{footmisc}
-
- \usepackage{color}
- \definecolor{theme-gray}{gray}{.3}
-
-
- \setlength{\marginparsep}{2em}
- \setlength{\marginparwidth}{8.5em}
- \setlength{\oddsidemargin}{0pt}
- \clubpenalty=10000
- \widowpenalty=10000
+ \usepackage{wl}
</TeXML>
- <xsl:apply-templates select="rdf:RDF" mode='title' />
- <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" mode='title' />
+ <xsl:choose>
+ <xsl:when test="@old-morefloats">
+ <TeXML escape="0">
+ \IfFileExists{morefloats.sty}{
+ \usepackage{morefloats}
+ }{}
+ </TeXML>
+ </xsl:when>
+ <xsl:otherwise>
+ <TeXML escape="0">
+ \usepackage[maxfloats=64]{morefloats}
+ </TeXML>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:apply-templates select="rdf:RDF" mode="titlepage" />
+ <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" mode='titlepage' />
<env name="document">
<cmd name="maketitle" />
+
+ <xsl:choose>
+ <xsl:when test="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/nazwa_utworu">
+ <xsl:apply-templates select="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/autor_utworu" mode="title" />
+ <!-- title in master -->
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- look for author title in dc -->
+ <xsl:apply-templates select="rdf:RDF" mode="firstdctitle" />
+ <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" mode='firstdctitle' />
+ </xsl:otherwise>
+ </xsl:choose>
<xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" />
<xsl:apply-templates select="utwor" mode="part" />
</env>
</xsl:template>
<xsl:template match="utwor" mode="part">
- <xsl:if test="utwor">
- <xsl:apply-templates select="rdf:RDF" mode='subtitle' />
- <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" mode='subtitle' />
- </xsl:if>
+ <!-- title for empty dc -->
+ <xsl:choose>
+ <xsl:when test="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/nazwa_utworu">
+ <!-- title in master -->
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- look for title in dc -->
+ <xsl:apply-templates select="rdf:RDF" mode="dctitle" />
+ <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" mode='dctitle' />
+ </xsl:otherwise>
+ </xsl:choose>
+
<xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" />
<xsl:apply-templates select="utwor" mode="part" />
</xsl:template>
+<!-- =================== -->
+<!-- = MAIN TITLE PAGE = -->
+<!-- = (from DC) = -->
+<!-- =================== -->
-<!-- ============================================================================== -->
-<!-- = MASTER TAG = -->
-<!-- = (can contain block tags, paragraph tags, standalone tags and special tags) = -->
-<!-- ============================================================================== -->
+<xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" mode="titlepage">
+ <xsl:apply-templates select="rdf:RDF" mode="titlepage" />
+</xsl:template>
-<xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" mode="title">
- <xsl:apply-templates select="rdf:RDF" mode='title' />
+<xsl:template match="rdf:RDF" mode="titlepage">
+ <cmd name='title'><parm>
+ <xsl:apply-templates select=".//dc:title/node()" mode="inline" />
+ </parm></cmd>
+ <cmd name='author'><parm>
+ <xsl:apply-templates select=".//dc:creator_parsed/node()" mode="inline" />
+ </parm></cmd>
+ <TeXML escape="0">
+ \def\sourceinfo{<TeXML escape="1"><xsl:apply-templates select=".//dc:source/node()" mode="inline" /></TeXML>}
+ </TeXML>
</xsl:template>
-<xsl:template match="rdf:RDF" mode="title">
-<!-- TODO!
- <cmd name='title'><parm>
- <xsl:apply-templates select="dzielo_nadrzedne|podtytul" mode="header" />
- </parm></cmd>
- czytanie z tagów nazwa_utworu, autor_utworu
--->
+<!-- ============== -->
+<!-- = BOOK TITLE = -->
+<!-- = (from DC) = -->
+<!-- ============== -->
- <cmd name='title'><parm>
- <xsl:apply-templates select=".//dc:title" mode="header" />
- </parm></cmd>
- <cmd name='author'><parm>
- <xsl:apply-templates select=".//dc:author" mode="header" />
- </parm></cmd>
+<xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" mode="dctitle">
+ <xsl:apply-templates select="rdf:RDF" mode="dctitle" />
</xsl:template>
-<xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" mode="subtitle">
- <xsl:apply-templates select="rdf:RDF" mode='subtitle' />
+<xsl:template match="rdf:RDF" mode="dctitle">
+ <cmd name="section*"><parm>
+ <xsl:apply-templates select=".//dc:title/node()" mode="inline" />
+ </parm></cmd>
</xsl:template>
-<xsl:template match="rdf:RDF" mode="subtitle">
- <cmd name='part*'><parm>
- <xsl:apply-templates select=".//dc:title" mode="header" />
- </parm></cmd>
+
+<xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" mode="firstdctitle">
+ <xsl:apply-templates select="rdf:RDF" mode="firstdctitle" />
</xsl:template>
+<xsl:template match="rdf:RDF" mode="firstdctitle">
+ <cmd name="subsection*"><parm>
+ <xsl:apply-templates select=".//dc:creator_parsed/node()" mode="inline" />
+ </parm></cmd>
+ <cmd name="section*"><parm>
+ <xsl:apply-templates select=".//dc:title/node()" mode="inline" />
+ </parm></cmd>
+</xsl:template>
+<!-- ============================================================================== -->
+<!-- = MASTER TAG = -->
+<!-- = (can contain block tags, paragraph tags, standalone tags and special tags) = -->
+<!-- ============================================================================== -->
+
<xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny">
<xsl:apply-templates />
</xsl:template>
</xsl:template>
<xsl:template match="lista_osob">
- <cmd name="par">
+ <cmd name="par"><parm>
<cmd name="textbf">
- <parm><xsl:value-of select="naglowek_listy" /></parm>
+ <parm><xsl:apply-templates select="naglowek_listy" mode="inline" /></parm>
</cmd>
<env name="itemize">
<xsl:apply-templates select="lista_osoba" />
</env>
- </cmd>
+ </parm></cmd>
</xsl:template>
<xsl:template match="dedykacja">
- <cmd name="raggedleft"><parm>
- <env name="em">
- <xsl:apply-templates />
+ <env name="em">
+ <env name="flushright">
+ <xsl:apply-templates/>
</env>
- </parm></cmd>
+ </env>
</xsl:template>
<xsl:template match="kwestia">
<!-- = PARAGRAPH TAGS = -->
<!-- = (can contain inline and special tags) = -->
<!-- ========================================== -->
-<!-- Title page -->
-<xsl:template match="autor_utworu" mode="header">
- <xsl:apply-templates mode="inline" />
-</xsl:template>
-<xsl:template match="nazwa_utworu" mode="header">
- <xsl:apply-templates mode="inline" />
-</xsl:template>
-
-<xsl:template match="dzielo_nadrzedne" mode="header">
- <xsl:apply-templates mode="inline" />
-</xsl:template>
-
-<xsl:template match="podtytul" mode="header">
- <xsl:apply-templates mode="inline" />
+<!-- only in root -->
+<xsl:template match="autor_utworu" mode="title">
+ <cmd name="subsection*"><parm>
+ <xsl:apply-templates mode="inline" />
+ </parm></cmd>
</xsl:template>
-
<xsl:template match="nazwa_utworu">
- <cmd name="pagebreak" />
<cmd name="section*"><parm>
<xsl:apply-templates mode="inline" />
</parm></cmd>
</xsl:template>
<xsl:template match="naglowek_osoba|naglowek_podrozdzial">
- <cmd name="paragraph*">
+ <cmd name="par">
<parm><xsl:apply-templates mode="inline" /></parm>
- </cmd>
+ </cmd><cmd name="nopagebreak" />
</xsl:template>
<!-- Other paragraph tags -->
<xsl:template match="strofa">
<cmd name="par"><parm><cmd name="noindent"><parm>
- <xsl:choose>
- <xsl:when test="count(br) > 0">
+ <xsl:choose>
+ <xsl:when test="count(br) > 0">
+ <xsl:call-template name="verse">
+ <xsl:with-param name="verse-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
+ <xsl:with-param name="verse-type" select="br[1]/preceding-sibling::*[name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'][1]" />
+ </xsl:call-template>
+ <xsl:for-each select="br">
+ <TeXML escape="0">\\{}</TeXML>
+ <!-- Each BR tag "consumes" text after it -->
+ <xsl:variable name="lnum" select="count(preceding-sibling::br)" />
<xsl:call-template name="verse">
- <xsl:with-param name="verse-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
- <xsl:with-param name="verse-type" select="br[1]/preceding-sibling::*[name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'][1]" />
+ <xsl:with-param name="verse-content"
+ select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
+ <xsl:with-param name="verse-type" select="following-sibling::*[count(preceding-sibling::br) = $lnum+1 and (name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd')][1]" />
</xsl:call-template>
- <xsl:for-each select="br">
- <cmd name="newline" />
- <!-- Each BR tag "consumes" text after it -->
- <xsl:variable name="lnum" select="count(preceding-sibling::br)" />
- <xsl:call-template name="verse">
- <xsl:with-param name="verse-content"
- select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
- <xsl:with-param name="verse-type" select="following-sibling::*[count(preceding-sibling::br) = $lnum+1 and (name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd')][1]" />
- </xsl:call-template>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="verse">
- <xsl:with-param name="verse-content" select="text() | node()" />
- <xsl:with-param name="verse-type" select="wers_wciety|wers_akap|wers_cd[1]" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="verse">
+ <xsl:with-param name="verse-content" select="text() | node()" />
+ <xsl:with-param name="verse-type" select="wers_wciety|wers_akap|wers_cd[1]" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
<cmd name="vspace"><parm>1em</parm></cmd>
</parm></cmd></parm></cmd>
</xsl:template>
<xsl:template name="verse">
<xsl:param name="verse-content" />
<xsl:param name="verse-type" />
- <xsl:choose><xsl:when test="name($verse-type) = 'wers_akap'"><cmd name="hspace" ><parm><xsl:value-of select="$firet" />pt</parm></cmd></xsl:when>
+ <xsl:choose><xsl:when test="name($verse-type) = 'wers_akap'"><cmd name="hspace" ><parm>1em</parm></cmd></xsl:when>
<xsl:when test="name($verse-type) = 'wers_wciety'">
<xsl:choose>
- <xsl:when test="$verse-content/@typ">
+ <xsl:when test="string($verse-content/@typ)">
<cmd name="hspace" ><parm><xsl:value-of select="$verse-content/@typ" />em</parm></cmd>
</xsl:when>
<xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="name($verse-type) = 'wers_cd'">
- <cmd name="hspace" ><parm>12em</parm></cmd>
+ <cmd name="hspace" ><parm>8em</parm></cmd>
</xsl:when>
</xsl:choose>
<xsl:apply-templates select="$verse-content" mode="inline" />
</xsl:template>
<xsl:template match="motto_podpis">
- <cmd name="raggedleft"><parm>
- <xsl:apply-templates mode="inline" />
- </parm></cmd>
+ <env name="em">
+ <env name="flushright">
+ <xsl:apply-templates mode="inline"/>
+ </env>
+ </env>
</xsl:template>
-
<!-- ================================================ -->
<!-- = INLINE TAGS = -->
<!-- = (contain other inline tags and special tags) = -->
<!-- ================================================ -->
+
<!-- Annotations -->
<xsl:template match="pa|pe|pr|pt" mode="inline">
<cmd name="footnote"><parm><xsl:apply-templates mode="inline" /></parm></cmd>
</xsl:template>
<xsl:template match="wyroznienie" mode="inline">
- <!-- TODO: letterspacing 1pt -->
<cmd name="emph"><parm><xsl:apply-templates mode="inline" /></parm></cmd>
</xsl:template>
<!-- Themes -->
-<xsl:template match="begin" mode="inline">
- <xsl:variable name="mnum" select="concat('m', substring(@id, 2))" />
+<xsl:template match="begin|end|motyw">
+ <xsl:apply-templates select='.' mode="inline" />
+</xsl:template>
+
+<xsl:template match="begin" mode="inline" />
+<xsl:template match="end" mode="inline" />
+
+<xsl:template match="motyw" mode="inline">
<cmd name="mbox" />
<cmd name="marginpar">
- <parm><cmd name="raggedright"><parm>
- <cmd name="hspace"><parm>0pt</parm></cmd>
- <cmd name="footnotesize"><parm>
- <cmd name="color"><parm>theme-gray</parm><parm>
- <xsl:value-of select="string(following::motyw[@id=$mnum]/text())" />
+ <parm>
+ <cmd name="vspace"><parm>-8pt</parm></cmd>
+ <xsl:if test="@moved">
+ <cmd name="vspace"><parm>-<xsl:value-of select="@moved" /><cmd name="baselineskip" /></parm></cmd>
+ </xsl:if>
+ <cmd name="raggedright"><parm>
+ <cmd name="hspace"><parm>0pt</parm></cmd>
+ <cmd name="footnotesize"><parm>
+ <cmd name="color"><parm>theme</parm><parm>
+ <xsl:apply-templates mode="inline" />
+ </parm></cmd>
</parm></cmd>
</parm></cmd>
- </parm></cmd></parm>
+ <cmd name="vspace"><parm><cmd name="baselineskip" /></parm></cmd>
+ </parm>
</cmd>
</xsl:template>
-<xsl:template match="begin|end">
- <xsl:apply-templates select='.' mode="inline" />
-</xsl:template>
-
-<xsl:template match="end" mode="inline" />
-<xsl:template match="motyw" mode="inline" />
-
<!-- ============== -->
<!-- = ADDED TAGS = -->
<xsl:template match="extra|uwaga" />
<xsl:template match="extra|uwaga" mode="inline" />
+<xsl:template match="nota_red" />
<!-- ======== -->
<!-- = TEXT = -->
<!-- ======== -->
<xsl:template match="text()" />
<xsl:template match="text()" mode="inline">
- <xsl:value-of select="wl:substitute_entities(.)" />
+ <xsl:if test="preceding-sibling::node() and wl:starts_white(.)">
+ <xsl:text> </xsl:text>
+ </xsl:if>
+
+ <xsl:value-of select="wl:substitute_entities(wl:strip(.))" />
+
+ <xsl:if test="following-sibling::node() and wl:ends_white(.)">
+ <xsl:text> </xsl:text>
+ </xsl:if>
</xsl:template>