Difference between revisions of "Tei2wikisource1.xsl"
Jump to navigation
Jump to search
Filologanoga (talk | contribs) (created) |
Filologanoga (talk | contribs) (→TEI to Wikisource (Vicifons): link to stylesheet 3) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== TEI to Wikisource (Vicifons) == | == TEI to Wikisource (Vicifons) == | ||
− | This is the first in the set of three stylesheets which convert TEI [http://www.ffzg.hr/klafil/croala | + | This is the first in the set of three stylesheets which convert TEI [http://www.ffzg.hr/klafil/croala Croatiae auctores Latini] documents to Wikisource (namely its Latin version, [http://la.wikisource.org/wiki/Pagina_prima Vicifons]) format, inserting wikisource "formulae" at appropriate places. |
This is a stylesheet for simple prose texts. | This is a stylesheet for simple prose texts. | ||
+ | |||
+ | Cf. [[Tei2wikisource2.xsl]], [[Tei2wikisource3.xsl]]. | ||
<pre><nowiki> | <pre><nowiki> |
Latest revision as of 12:30, 5 February 2011
TEI to Wikisource (Vicifons)
This is the first in the set of three stylesheets which convert TEI Croatiae auctores Latini documents to Wikisource (namely its Latin version, Vicifons) format, inserting wikisource "formulae" at appropriate places.
This is a stylesheet for simple prose texts.
Cf. Tei2wikisource2.xsl, Tei2wikisource3.xsl.
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" exclude-result-prefixes="tei"> <!-- tei to wiki 2 --> <!-- description: converts prose texts from Croatiae auctores Latini to wikisource (mediawiki) markup --> <!-- description: adds navigatione elements (vicifons formula liber) --> <!-- author: Neven Jovanović, Croatiae auctores Latini --> <!-- filename: 1102wiki-prorsa.xsl --> <!-- modified: 2011-02-04 --> <!-- required input: tei xml file, using a CroALa subset (or similar) --> <!-- expected output: text file conforming to vicifons with titulus2 and liber formulae --> <!-- vicifons titulus2: http://la.wikisource.org/wiki/Formula:Titulus2 --> <!-- vicifons liber: http://la.wikisource.org/wiki/Formula:Liber --> <!-- known restrictions: requires removal of indent spaces --> <!-- known restrictions: formula Titulus2 should be repeated at the beginning of each chapter --> <xsl:output method="html"/> <xsl:template match="//tei:teiHeader"> <!-- content for formula Titulus2 --> <xsl:text> {{titulus2 |Scriptor= </xsl:text><xsl:value-of select="normalize-space(tei:fileDesc/tei:titleStmt/tei:author)"/> <xsl:text> |OperaeTitulus= </xsl:text><xsl:value-of select="normalize-space(tei:fileDesc/tei:titleStmt/tei:title)"/><!-- Operae Titulus (required) --> <xsl:text> |OperaeWikiPagina= </xsl:text><!-- Latina Vicifontis Pagina --> <xsl:text> |Liber= </xsl:text><xsl:value-of select="normalize-space(//tei:sourceDesc//tei:biblStruct)"/><!-- Liber --> <xsl:text> |SubTitulus= </xsl:text><!-- SubTitulus --> <xsl:text> |Annus= </xsl:text><xsl:value-of select="normalize-space(tei:profileDesc//tei:creation/tei:date)"/><!-- Annus/Saeculum --> <xsl:text> }} </xsl:text> </xsl:template> <xsl:template match="//tei:front/tei:div"> <xsl:text> {{Liber |Ante= Titulus operis |AnteNomen= </xsl:text><xsl:value-of select="normalize-space(//tei:fileDesc/tei:titleStmt/tei:title)"/><xsl:text> |Post= Liber |PostNomen= </xsl:text><xsl:value-of select="normalize-space(//tei:body/tei:div[1]/tei:head)"/><xsl:text> }} </xsl:text> <div class="text"> <xsl:apply-templates/> </div> </xsl:template> <xsl:template match="//tei:body/tei:div/tei:div"> <!-- should be corrected for front and ch. 1! --> <xsl:text> {{Liber |Ante= </xsl:text><xsl:value-of select="normalize-space(preceding-sibling::tei:div[1]/tei:head)"/><xsl:text> |AnteNomen= </xsl:text><xsl:value-of select="normalize-space(preceding-sibling::tei:div[1]/tei:head)"/><xsl:text> |Post= </xsl:text><xsl:value-of select="normalize-space(following-sibling::tei:div[1]/tei:head)"/><xsl:text> |PostNomen= </xsl:text><xsl:value-of select="normalize-space(following-sibling::tei:div[1]/tei:head)"/><xsl:text> }}</xsl:text> <div class="text"><xsl:text> ==</xsl:text><xsl:value-of select="normalize-space(tei:head)"/><xsl:text>== </xsl:text> <xsl:apply-templates select="tei:p"/> </div> <xsl:apply-templates select="." mode="back"/> <!-- modes for repeating the Liber formula --> </xsl:template> <xsl:template match="//tei:body/tei:div/tei:div" mode="back"> <xsl:text> {{Liber |Ante= </xsl:text><xsl:value-of select="normalize-space(preceding-sibling::tei:div[1]/tei:head)"/><xsl:text> |AnteNomen= </xsl:text><xsl:value-of select="normalize-space(preceding-sibling::tei:div[1]/tei:head)"/><xsl:text> |Post= </xsl:text><xsl:value-of select="normalize-space(following-sibling::tei:div[1]/tei:head)"/><xsl:text> |PostNomen= </xsl:text><xsl:value-of select="normalize-space(following-sibling::tei:div[1]/tei:head)"/><xsl:text> }}</xsl:text> </xsl:template> <xsl:template match="//tei:back//text()"/> <!-- remove any notes from the back --> </xsl:stylesheet>