Skip to content
Permalink
cc2f136e64
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
274 lines (249 sloc) 8.31 KB
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:tei="http://www.tei-c.org/ns/1.0"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
version="1.0"
exclude-result-prefixes="tei cc rdf"
>
<!--
things missing:
- EOAparthtml
- numbering and ordering
- footnotes have a sup above and are gathered below
-
-->
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:template match="/">
<xsl:element name="EOAdocument">
<xsl:apply-templates select="//tei:div[@type='chapter']"/>
</xsl:element>
</xsl:template>
<!--
<div type="part" n="1" xml:id="part1">
<head>This is the first part</head>
-->
<xsl:template match="//tei:div[@type='part']/tei:head">
<xsl:element name="EOAparthtml">
<xsl:element name="head">
<xsl:value-of select="."/>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="//tei:div[@type='chapter'][not(@rend='nonumber')]">
<xsl:element name="EOAchapter">
<xsl:attribute name="language">
<xsl:value-of select="//tei:langUsage/tei:language/@ident"/>
</xsl:attribute>
<xsl:attribute name="order">
<xsl:value-of select="position()"/>
</xsl:attribute>
<xsl:attribute name="number">
<xsl:value-of select="@n"/>
</xsl:attribute>
<xsl:apply-templates/>
<xsl:element name="EOAsection">
<xsl:element name="head">
<xsl:text>Footnotes</xsl:text>
</xsl:element>
</xsl:element>
<xsl:apply-templates select="//tei:note[@place='bottom']"/>
<xsl:element name="EOAfootnote">
<xsl:attribute name="anchor">
<xsl:value-of select="tei:note/@n"/>
</xsl:attribute>
<xsl:value-of select="tei:note[@place='bottom']/tei:p"/>
<!-- </xsl:template> -->
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="//tei:div[@type='chapter'][@rend='nonumber']">
<xsl:element name="EOAchapter">
<xsl:attribute name="language">
<xsl:value-of select="//tei:langUsage/tei:language/@ident"/>
</xsl:attribute>
<xsl:attribute name="order">
<xsl:value-of select="@n"/>
</xsl:attribute>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="//tei:div[@type='section'][not(@rend='nonumber')]/tei:head">
<xsl:element name="EOAsection">
<xsl:attribute name="number">
<xsl:value-of select="@n"/>
</xsl:attribute>
<xsl:attribute name="order">
<xsl:value-of select="@n"/>
</xsl:attribute>
<xsl:element name="head">
<xsl:value-of select="."/>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="//tei:div[@type='section'][@rend='nonumber']/tei:head">
<xsl:element name="EOAsection">
<xsl:attribute name="order">
<xsl:value-of select="@n"/>
</xsl:attribute>
<xsl:element name="head">
<xsl:value-of select="."/>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="//tei:div[@type='subsection'][not(@rend='nonumber')]/tei:head">
<xsl:element name="EOAsubsection">
<xsl:attribute name="order">
<xsl:value-of select="@n"/>
</xsl:attribute>
<xsl:attribute name="number">
<xsl:value-of select="@n"/>
</xsl:attribute>
<xsl:element name="head">
<xsl:value-of select="."/>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="//tei:div[@type='subsection'][@rend='nonumber']/tei:head">
<xsl:element name="EOAsubsection">
<xsl:attribute name="order">
<xsl:value-of select="@n"/>
</xsl:attribute>
<xsl:element name="head">
<xsl:value-of select="."/>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="//tei:div[@type='subsubsection']/tei:head">
<xsl:element name="EOAsubsubsection">
<xsl:attribute name="order">
<xsl:value-of select="@n"/>
</xsl:attribute>
<xsl:element name="head">
<xsl:value-of select="."/>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="//tei:div[@type='chapter']/tei:head">
<xsl:element name="head">
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
<xsl:template match="tei:p">
<xsl:element name="EOAparagraph">
<xsl:attribute name="order">
<xsl:value-of select="position()"/>
</xsl:attribute>
<!-- <xsl:value-of select="."/> -->
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="tei:p[@rend='Quote']">
<xsl:element name="EOAparagraph">
<xsl:attribute name="order">
<xsl:value-of select="position()"/>
</xsl:attribute>
<xsl:attribute name="rend">
<xsl:text>quoted</xsl:text>
</xsl:attribute>
<!-- <xsl:value-of select="."/> -->
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<!--
<span rel="popover" class="citation" data-toggle="popover" html="true" data-placement="bottom" data-title="Descartes 1644, 37–44" data-content="Principia philosophiae.">Descartes 1644, 37–44</span>
-->
<xsl:template match="tei:bibl/tei:abbr[@type='authoryear']">
<xsl:element name="span">
<xsl:attribute name="rel">
<xsl:text>popover</xsl:text>
</xsl:attribute>
<xsl:attribute name="class">
<xsl:text>citation</xsl:text>
</xsl:attribute>
<xsl:attribute name="data-toggle">
<xsl:text>popover</xsl:text>
</xsl:attribute>
<xsl:attribute name="html">
<xsl:text>true</xsl:text>
</xsl:attribute>
<xsl:attribute name="citekey">
<xsl:value-of select="substring-after(../tei:ref/@target, '#')"/>
</xsl:attribute>
<xsl:attribute name="data-placement">
<xsl:text>bottom</xsl:text>
</xsl:attribute>
<xsl:attribute name="data-title">
<xsl:value-of select="."/>
</xsl:attribute>
<xsl:attribute name="data-content">
<xsl:value-of select="../tei:abbr[@type='title']"/>
<!-- <xsl:text>Here goes the title of the publication</xsl:text> -->
</xsl:attribute>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="tei:figure">
<xsl:element name="EOAfigure">
<xsl:attribute name="file">
<xsl:value-of select="tei:graphic/@url"/>
</xsl:attribute>
<!-- <xsl:apply-templates/> -->
<xsl:element name="caption">
<xsl:value-of select="tei:head/text()"/>
</xsl:element>
</xsl:element>
</xsl:template>
<!-- <EOAfigure file="images1.jpg" width="66px;" order="8" number="4.1"><caption>An image with a caption. It resembles a bird looking at you. Doesn't it? And do you think it looks angry?</caption></EOAfigure> -->
<xsl:template match="tei:note[@place='bottom']/tei:p">
<xsl:element name="sup">
<xsl:attribute name="class">
<xsl:text>footnote</xsl:text>
</xsl:attribute>
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="concat('#fn', ../@n)"/>
</xsl:attribute>
<xsl:value-of select="../@n"/>
</xsl:element>
</xsl:element>
</xsl:template>
<!-- <sup class="footnote"><a href="#fn1">1</a></sup> -->
<!--
<xsl:template match="tei:note[@place='bottom']/tei:p">
<xsl:element name="EOAfootnote">
<xsl:attribute name="anchor">
<xsl:value-of select="../@n"/>
</xsl:attribute>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
-->
<xsl:template match="tei:hi[@rend='italic']">
<xsl:element name="em">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="tei:hi[@rend='sup']">
<xsl:element name="sup">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="tei:hi[@rend='sub']">
<xsl:element name="sub">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<!--
<xsl:template match="tei:hi[@rend='math']">
<xsl:element name="em">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
-->
<xsl:template match="tei:hi[@rend='bold']">
<xsl:element name="b">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>