Tei2newton

From TEIWiki
Jump to navigation Jump to search
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>

<!--

  tei2newton.xsl
  
  This is the beginnings of a XSLT file to convert TEI 4 documents into
  Newton Paperback files. ("Remember Apple Newtons?"). The resulting
  file will need to be "compiled" with a program called PBBookMaker in
  order to actually create a file the Newton can read.
  
  This file is distributed under the GNU Public License.
  
  Eric Lease Morgan (eric_morgan@infomotions.com)
  May 5, 2005

-->

<xsl:output method='text' />
<xsl:template match='TEI.2'>
<xsl:text>&#xD;</xsl:text>###<xsl:value-of select='teiHeader/fileDesc/titleStmt/title' /><xsl:text>&#xD;</xsl:text><xsl:value-of select='teiHeader/fileDesc/titleStmt/title' /><xsl:text>&#xD;&#xD;</xsl:text>Originally written/published in <xsl:value-of select='teiHeader/profileDesc/creation/date' /> by <xsl:value-of select='teiHeader/fileDesc/titleStmt/author' /><xsl:text>&#xD;</xsl:text><!-- cool table of contents --><xsl:text>&#xD;</xsl:text><xsl:if test='/TEI.2/text/body/div1'><xsl:text>&#xD;</xsl:text>Table of contents<xsl:text>&#xD;</xsl:text><xsl:for-each select="/TEI.2/text/body/div1"><xsl:text>&#xD;</xsl:text><xsl:value-of select='./head' /><xsl:text>&#xD;</xsl:text></xsl:for-each><xsl:text>&#xD;</xsl:text></xsl:if><xsl:text>&#xD;</xsl:text><!-- do the heavy lifting --><xsl:text>&#xD;</xsl:text><xsl:apply-templates/>	<xsl:text>&#xD;</xsl:text><xsl:text>&#xD;</xsl:text>###Colophon<xsl:text>&#xD;&#xD;</xsl:text>Colophon<xsl:text>&#xD;&#xD;</xsl:text>This file was originally marked up using the Text Encoding Initiative XML markup language for use in the Infomotions Alex Catalog of Electronic Texts (http://infomotions.com/alex/) by <xsl:value-of select='teiHeader/revisionDesc/change/respStmt/name'/> on <xsl:value-of select='teiHeader/fileDesc/publicationStmt/date'/> for the purpose of freely sharing, distributing, and making available works of great literature. This file is placed in the public domain. It's Infomotions unique identifier is <xsl:value-of select='teiHeader/fileDesc/publicationStmt/idno'/>. <xsl:value-of select='teiHeader/fileDesc/sourceDesc/p'/>.<xsl:text>&#xD;&#xD;</xsl:text>"Give back to the 'Net."<xsl:text>&#xD;</xsl:text></xsl:template>
	
<!-- division #1 (div1) -->
<xsl:template match="div1"><xsl:text>&#xD;</xsl:text>###<xsl:value-of select='./head'/>
<xsl:text>&#xD;</xsl:text><xsl:text>&#xD;</xsl:text><xsl:value-of select='./head'/>
<xsl:text>&#xD;</xsl:text>
<xsl:apply-templates />
</xsl:template>

<!-- paragraph (p) -->
<xsl:template match="p">
<xsl:text>&#xD;</xsl:text>
<xsl:apply-templates />
<xsl:text>&#xD;</xsl:text>
</xsl:template>


<!-- do nothing templates -->

<!-- teiheader (do nothing) -->
<xsl:template match="teiHeader" />

<!-- head (head) -->
<xsl:template match="head" />

</xsl:stylesheet>