aboutsummaryrefslogtreecommitdiff
path: root/xsl
diff options
context:
space:
mode:
Diffstat (limited to 'xsl')
-rw-r--r--xsl/inc/indent.xsl102
-rw-r--r--xsl/inc/teientry2txt.xsl444
-rw-r--r--xsl/inc/teiheader2txt.xsl251
-rw-r--r--xsl/re-indent.xsl25
-rw-r--r--xsl/sort.xsl30
-rw-r--r--xsl/tei-wrapper.xml19
-rw-r--r--xsl/tei2c5.xsl123
-rw-r--r--xsl/tei2dic.xsl391
-rw-r--r--xsl/tei2dictxml.xsl42
-rw-r--r--xsl/tei2txt.xsl18
10 files changed, 0 insertions, 1445 deletions
diff --git a/xsl/inc/indent.xsl b/xsl/inc/indent.xsl
deleted file mode 100644
index db742a8..0000000
--- a/xsl/inc/indent.xsl
+++ /dev/null
@@ -1,102 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-
- <!-- This is the template intended to be called from outside -->
- <xsl:template name="format">
- <!-- The text to be formatted nicely -->
- <xsl:param name="txt"/>
- <!-- A number giving the column width in which txt is to be formatted indented by $start spaces -->
- <xsl:param name="width" select="78"/>
- <!-- A number giving the columns the txt is to be indented -->
- <xsl:param name="start" select="0"/>
-
- <xsl:choose>
- <!-- Last Line -->
- <xsl:when test="string-length($txt) &lt; $width -$start">
- <xsl:value-of select="$txt"/>
- <xsl:text>&#10;</xsl:text>
- </xsl:when>
-
- <!-- substring() of a NULL string would be bad -->
- <xsl:when test="$txt">
- <!-- Find the word boundary of the last word that completely fits on the current line -->
- <xsl:variable name="real-width">
- <xsl:call-template name="space-backward">
- <xsl:with-param select="$txt" name="txt"/>
- <xsl:with-param select="$width - $start" name="width"/>
- <xsl:with-param select="$start" name="start"/>
- <xsl:with-param name="def">
- <xsl:call-template name="space-forward">
- <xsl:with-param select="$txt" name="txt"/>
- <xsl:with-param select="$width - $start" name="width"/>
- <xsl:with-param select="$start" name="start"/>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <!-- Output current line -->
- <xsl:value-of select="substring($txt, 1, $real-width)"/>
- <xsl:text>&#10;</xsl:text>
- <!-- Indent the next line -->
- <xsl:value-of select="substring(' ', 1, $start)"/>
- <!-- Recursively call myself -->
- <xsl:call-template name="format">
- <xsl:with-param select="substring($txt, $real-width + 1)" name="txt"/>
- <xsl:with-param select="$width" name="width"/>
- <xsl:with-param select="$start" name="start"/>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="space-backward">
- <xsl:param name="txt"/>
- <xsl:param name="width"/>
- <xsl:param name="def"/>
- <xsl:param name="start"/>
- <xsl:choose>
- <xsl:when test="$width = 0">
- <xsl:value-of select="$def"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="substring($txt, $width, 1) = ' '">
- <xsl:value-of select="$width"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="space-backward">
- <xsl:with-param select="$txt" name="txt"/>
- <xsl:with-param select="$width - 1" name="width"/>
- <xsl:with-param select="$def" name="def"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="space-forward">
- <xsl:param name="txt"/>
- <xsl:param name="width"/>
- <xsl:choose>
- <xsl:when test="$width >= string-length($txt)">
- <xsl:value-of select="string-length($txt)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="substring($txt, $width, 1) = ' '">
- <xsl:value-of select="$width"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="space-forward">
- <xsl:with-param select="$txt" name="txt"/>
- <xsl:with-param select="$width + 1" name="width"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-</xsl:stylesheet>
diff --git a/xsl/inc/teientry2txt.xsl b/xsl/inc/teientry2txt.xsl
deleted file mode 100644
index 51d506e..0000000
--- a/xsl/inc/teientry2txt.xsl
+++ /dev/null
@@ -1,444 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:xd="http://www.pnp-software.com/XSLTdoc"
- version="1.0">
-
- <xsl:include href="indent.xsl"/>
-
- <xsl:strip-space elements="*"/>
-
- <xsl:variable name="stylesheet-entry_svnid">$Id$</xsl:variable>
-
- <!-- I am fully aware of introducing some project-specific features into the P5 mode,
- but let this stuff reside here for a while until we come up with a clean way to
- import project-dependent overrides from the individual project directories... -PB 13-apr-09-->
-
- <!-- TEI entry specific templates -->
- <xsl:template match="tei:entry">
- <xsl:apply-templates select="tei:form"/>
- <!-- force form before gramGrp -->
- <xsl:apply-templates select="tei:gramGrp"/>
- <xsl:text>&#xa;</xsl:text>
- <xsl:apply-templates select="tei:sense | tei:note"/>
- </xsl:template>
-<!--Headword description FORM and GRAMGRP -->
- <xsl:template match="tei:form">
- <xsl:variable name="paren"
- select="count(child::tei:orth) and (count(parent::tei:form) = 1 or @type='infl')"/>
- <!-- parenthesized if nested or (ad hoc) if @type="infl" -->
- <!-- further adhockishness (I'm duly ashamed): you'd better check if the <orth> is really there, because you may be
- looking at nested <form>s; a rewrite is needed here -->
- <xsl:if test="$paren">
- <xsl:text> (</xsl:text>
- </xsl:if>
- <!-- mandatory entry > form > orth -->
- <xsl:apply-templates select="tei:usg | tei:lbl"/>
- <xsl:if test="position() != last()">
- <xsl:text> </xsl:text>
- </xsl:if>
- <!-- added to handle usg info in nested <form>s -->
- <xsl:for-each select="tei:orth">
- <xsl:choose>
- <!-- values from the TEI Guidelines -->
- <xsl:when test="count(@extent)=0 or @extent='full'">
- <xsl:value-of select="."/>
- </xsl:when>
- <xsl:when test="@extent='pref'">
- <xsl:value-of select="concat(.,'-')"/>
- </xsl:when>
- <xsl:when test="@extent='suff'">
- <xsl:value-of select="concat('-',.)"/>
- </xsl:when>
- <xsl:when test="@extent='part'">
- <xsl:value-of select="concat('-',.,'-')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="."/>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:if test="position() != last()">
- <xsl:text>, </xsl:text>
- </xsl:if>
- </xsl:for-each>
- <xsl:apply-templates select="tei:pron"/>
- <xsl:if test="position() != last()">
- <xsl:text> </xsl:text>
- </xsl:if>
- <!-- then, if nested, gramGrp or gram infos... -->
- <xsl:apply-templates select=" tei:gramGrp"/>
- <xsl:if test="position() != last()">
- <xsl:text> </xsl:text>
- </xsl:if>
- <xsl:apply-templates select="tei:form"/>
- <xsl:if test="following-sibling::tei:form and following-sibling::tei:form[1][not(@type='infl')]">
- <xsl:text>, </xsl:text>
- <!-- cosmetics: no comma before parens -->
- </xsl:if>
- <xsl:if test="$paren">
- <xsl:text>)</xsl:text>
- </xsl:if>
- </xsl:template>
-
- <!-- can't see when this template may be active; see above for enhancement (pref, suff), if necessary -->
- <xsl:template match="tei:orth">
- <xsl:value-of select="."/>
- <xsl:if test="position() != last()">
- <xsl:text>, </xsl:text>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="tei:pron">
- <xsl:value-of select="concat(' /',.,'/')"/>
- <!--<xsl:text> /</xsl:text><xsl:apply-templates/><xsl:text>/</xsl:text>-->
- </xsl:template>
-
- <!-- allow for empty <pos/>; make it a condition for the presence of angled brackets, too
- the weird "(self::gramGrp or count(tei:pos/text())"
- means "you're either P4 or <pos> in P5 is non-empty"
--->
- <xsl:template match="tei:gramGrp">
- <xsl:variable name="bracket"
- select="count(ancestor::tei:gramGrp)=0 and (count(tei:pos/text()) or count(tei:*[local-name() != 'pos']))"
- />
- <xsl:if test="$bracket">
- <xsl:text> &lt;</xsl:text>
- </xsl:if>
- <xsl:for-each
- select="tei:pos[text()] | tei:subc | tei:num | tei:number | tei:gen | tei:gramGrp | tei:iType | tei:gram | tei:case">
- <xsl:apply-templates select="."/>
- <xsl:if test="position()!=last()">
- <xsl:text>, </xsl:text>
- </xsl:if>
- </xsl:for-each>
- <xsl:if test="$bracket">
- <xsl:text>></xsl:text>
- </xsl:if>
-
- <!-- <xr> elements are not allowed inside <form> or <gramGrp>, so reach out and grab them... -->
- <xsl:if
- test="count(preceding-sibling::tei:xr[@type='plural-form' or @type='imp-form' or
- @type='past-form' or @type='infl-form'])">
- <xsl:text> </xsl:text>
- <xsl:apply-templates
- select="preceding-sibling::tei:xr[@type='plural-form' or @type='imp-form' or
- @type='past-form' or @type='infl-form']"
- />
- </xsl:if>
- <!-- horribly project-specific, will be overridden by project-specific imports later on;
- OTOH, we might make this a project feature, too, if there is a need -->
- <xsl:if test="preceding-sibling::tei:form/@type='N'">
- <xsl:text> [sg=pl]</xsl:text>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="tei:gram[@type='cl-agr']">
- <xsl:value-of select="concat('agr: ',.)"/>
- </xsl:template>
-
-<!-- senses -->
- <xsl:template match="tei:sense">
- <xsl:variable name="prec_senses">
- <xsl:choose>
- <xsl:when test="not(preceding-sibling::tei:sense)">0</xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="count(preceding-sibling::tei:sense)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="pref">
- <xsl:choose>
- <xsl:when test="@n">
- <xsl:value-of select="concat(@n,'. ')"/>
- </xsl:when>
- <xsl:when test="number($prec_senses) > 0 or following-sibling::tei:sense">
- <xsl:value-of select="concat(position(),'. ')"/>
- </xsl:when>
- </xsl:choose>
- </xsl:variable>
- <xsl:if test="number($prec_senses) > 0">
- <xsl:text>&#xa;</xsl:text>
- </xsl:if>
- <xsl:value-of select="concat(' ',$pref)"/>
- <xsl:apply-templates/>
- </xsl:template>
-
- <xsl:template match="tei:cit"><!--cit can be @trans, @example, (@colloc) and simple cit (for idiomatic expression)-->
- <xsl:choose>
- <xsl:when test="@type ='trans'">
-<!-- <xsl:if test="preceding-sibling::tei:cit[@type='trans']"><xsl:text> ◊ </xsl:text></xsl:if> -->
- <xsl:if test="not(preceding-sibling::tei:cit[@type='trans']) and parent::tei:cit"><xsl:text> - </xsl:text></xsl:if>
- <xsl:if test="preceding-sibling::tei:cit[@type='trans']"><xsl:text>, </xsl:text></xsl:if>
- <xsl:apply-templates/>
- </xsl:when>
- <xsl:when test="@type ='example'">
- <xsl:text>&#xa; </xsl:text>
- <xsl:apply-templates/>
- </xsl:when>
- <xsl:when test="@type ='colloc'">
- <xsl:text> (</xsl:text>
- <xsl:apply-templates/>
- <xsl:text>) </xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates/>
- <xsl:text> </xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="tei:quote">
- <xsl:choose>
- <xsl:when test="parent::tei:cit[@type='example']">
- <xsl:value-of select="concat('&quot;',.,'&quot; ')"/>
- </xsl:when><!--
- <xsl:when test="parent::tei:cit[@type='trans'][parent::tei:cit]">
-
- <xsl:value-of select="concat(' - ',.,' ')"/>
- </xsl:when>-->
- <xsl:when test="preceding-sibling::tei:quote"> <!-- parent::tei:cit[@type='trans'] and -->
- <xsl:value-of select="', '"/>
- <xsl:apply-templates/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template><!---->
-
- <xsl:template match="tei:usg">
- <xsl:text> [</xsl:text>
- <xsl:value-of select="."/>
- <xsl:text>] </xsl:text>
- </xsl:template>
-
- <xsl:template match="tei:def">
- <xsl:variable name="stuff">
- <xsl:apply-templates select="*|text()"/>
- </xsl:variable>
- <!-- first question: am I abused? Do I hold a translation equivalent
- within a <sense>, or am I a real definition within a <cit>? -->
- <xsl:choose>
- <xsl:when test="parent::tei:sense">
- <xsl:variable name="separator">
- <xsl:choose>
- <xsl:when test="preceding-sibling::tei:def">
- <xsl:value-of select="'; '"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="' '"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:value-of select="concat($separator,$stuff)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="format">
- <xsl:with-param name="txt" select="normalize-space($stuff)"/>
- <xsl:with-param name="width" select="75"/>
- <xsl:with-param name="start" select="4"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="tei:xr">
- <xsl:choose>
- <xsl:when test="count(@rend) and @rend='as-is'">
- <xsl:apply-templates/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="not(@type) or @type='cf'">
- <xsl:text>&#xa; See also: </xsl:text>
- <xsl:apply-templates select="tei:ref"/>
- <!-- <xsl:text>&#xa;</xsl:text> -->
- </xsl:when>
- <xsl:when test="@type='syn'">
- <xsl:text>&#xa; </xsl:text>
- <xsl:choose>
- <xsl:when test="count(tei:ref) &gt; 1">
- <xsl:text>Synonyms: </xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>Synonym: </xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:apply-templates select="tei:ref"/>
- <!-- <xsl:text>&#xa;</xsl:text> -->
- </xsl:when>
- <xsl:when test="@type='ant'">
- <xsl:text>&#xa; </xsl:text>
- <xsl:choose>
- <xsl:when test="count(tei:ref) &gt; 1">
- <xsl:text>Antonyms: </xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>Antonym: </xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:apply-templates select="tei:ref"/>
- <!-- <xsl:text>&#xa;</xsl:text> -->
- </xsl:when>
- <xsl:when test="@type='infl-base'">
- <!-- inflectional base -->
- <xsl:text>&#xa; Inflection of: </xsl:text>
- <xsl:apply-templates select="tei:ref"/>
- <xsl:text>&#xa;</xsl:text>
- </xsl:when>
- <xsl:when test="@type='deriv-base'">
- <!-- derivational/compound base -->
- <xsl:text>&#xa; Derived from: </xsl:text>
- <xsl:apply-templates select="tei:ref"/>
- <xsl:text>&#xa;</xsl:text>
- </xsl:when>
- <!-- the <xr>s below are positioned inline -->
- <xsl:when test="@type='imp-form'">
- <!-- imperative -->
- <xsl:text>(imp: </xsl:text>
- <xsl:apply-templates select="tei:ref"/>
- <xsl:text>)</xsl:text>
- </xsl:when>
- <xsl:when test="@type='plural-form'">
- <!-- plural -->
- <xsl:text>(pl: </xsl:text>
- <xsl:apply-templates select="tei:ref"/>
- <xsl:text>)</xsl:text>
- </xsl:when>
- <xsl:when test="@type='past-form'">
- <!-- past -->
- <xsl:text>(past: </xsl:text>
- <xsl:apply-templates select="tei:ref"/>
- <xsl:text>)</xsl:text>
- </xsl:when>
- <xsl:when test="@type='infl-form'">
- <!-- general inflections, e.g. past/pprt/fut -->
- <xsl:text>(</xsl:text>
- <xsl:apply-templates select="tei:ref"/>
- <xsl:text>)</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <!-- unknown type: print the value and set it on a separate line -->
- <xsl:text>&#xa; </xsl:text>
- <xsl:value-of select="concat(@type,': ')"/>
- <xsl:apply-templates select="tei:ref"/>
- <xsl:text>&#xa;</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="tei:ref">
- <xsl:if test="preceding-sibling::*[1][self::tei:ref]">
- <xsl:text>, </xsl:text>
- </xsl:if>
- <xsl:choose>
- <xsl:when test="ancestor::tei:teiHeader or ancestor::tei:front">
- <xsl:value-of select="concat(.,' [',@target,']')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat('{',.,'}')"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="tei:entry//tei:p">
- <xsl:apply-templates/>
- </xsl:template>
-
- <xsl:template match="tei:note[@type='editor']" priority="1"/>
-
- <xsl:template match="tei:entry//tei:note">
- <xsl:variable name="stuff">
- <xsl:apply-templates/>
- </xsl:variable>
- <xsl:variable name="spc">
- <xsl:choose>
- <xsl:when test="(count(preceding-sibling::node())=0) or @rend='noindent'">
- <xsl:value-of select="''"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="' '"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="count(@*)=0">
- <xsl:value-of select="concat('&#xa; Note: ',$stuff)"/>
- </xsl:when>
- <xsl:when test="@resp='translator'">
- <xsl:text>&#xa; Entry edited by: </xsl:text>
- <xsl:value-of select="."/>
- <xsl:text>&#xa;</xsl:text>
- </xsl:when>
- <!-- a subset of values from the TEI Guidelines -->
- <xsl:when
- test="@type='lbl' or @type='dom' or @type='obj' or @type='subj' or @type='hint' or @type='num' or @type='geo' or @type='syn' or @type='colloc'">
- <xsl:value-of select="concat($spc,'(',.,')')"/>
- </xsl:when>
- <xsl:when test="@type='gram'">
- <xsl:text>&#xa;</xsl:text>
- <xsl:call-template name="format">
- <xsl:with-param name="txt" select="concat(' (',normalize-space($stuff),')')"/>
- <!-- select="concat(' Note (gram.): ',normalize-space($stuff))"-->
- <xsl:with-param name="width" select="75"/>
- <xsl:with-param name="start" select="1"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="@type='usage'">
- <xsl:text>&#xa;</xsl:text>
- <xsl:call-template name="format">
- <xsl:with-param name="txt" select="concat(' (',normalize-space($stuff),')')"/>
- <!-- select="concat(' Usage: ',normalize-space($stuff))"-->
- <xsl:with-param name="width" select="75"/>
- <xsl:with-param name="start" select="1"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="@type='def'">
- <xsl:text>&#xa;</xsl:text>
- <xsl:call-template name="format">
- <!--<xsl:with-param name="txt" select="concat(' Def.: ',normalize-space())"/>-->
- <xsl:with-param name="txt" select="concat(' ',normalize-space($stuff))"/>
- <xsl:with-param name="width" select="75"/>
- <xsl:with-param name="start" select="1"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat($spc,'(',$stuff,')')"/>
- <xsl:text>&#xa;</xsl:text>
- </xsl:otherwise>
- <!--<xsl:when test="text()">
- <xsl:text>&#xa; Note: </xsl:text>
- <xsl:value-of select="text()"/>
- </xsl:when>-->
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="tei:q">
- <xsl:value-of select="concat('&quot;',.,'&quot;')"/>
- </xsl:template>
-
- <xsl:template match="tei:lbl">
- <xsl:text> (</xsl:text>
- <xsl:value-of select="."/>
- <xsl:text>) </xsl:text>
-</xsl:template>
-
- <xsl:template match="tei:author">
- <xsl:value-of select="concat(.,' ')"/>
-</xsl:template>
-
-<xsl:template match=" tei:pos | tei:subc | tei:num | tei:number | tei:gen | tei:iType | tei:gram | tei:case">
- <xsl:choose>
- <xsl:when test="not(parent::tei:gramGrp)">
- <xsl:value-of select="concat(' ',.)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="."/>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-</xsl:stylesheet>
-
diff --git a/xsl/inc/teiheader2txt.xsl b/xsl/inc/teiheader2txt.xsl
deleted file mode 100644
index 7c6ecff..0000000
--- a/xsl/inc/teiheader2txt.xsl
+++ /dev/null
@@ -1,251 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:xd="http://www.pnp-software.com/XSLTdoc">
-
- <xsl:import href="indent.xsl"/>
-
- <!-- Width of display, so indendation can be done nicely -->
- <xsl:param name="width" select="75"/>
- <xsl:param name="current-date"/>
-
- <xsl:strip-space elements="*"/>
-
-
- <!-- For transforming the teiHeader -->
-
- <xsl:template match="tei:titleStmt">
- <xsl:value-of select="tei:title"/>
- <xsl:text>&#xa;&#xa;</xsl:text>
- <xsl:for-each select="tei:respStmt">
- <xsl:value-of select="tei:resp"/>: <xsl:value-of select="tei:name"/>
- <xsl:text>&#xa;</xsl:text>
- </xsl:for-each>
- <xsl:text>&#xa;</xsl:text>
- </xsl:template>
-
- <!-- editionStmt consists of <edition/> followed by (respStmt)* -->
- <xsl:template match="tei:editionStmt">
- <xsl:text>Edition: </xsl:text>
- <xsl:apply-templates select="tei:edition"/>
- <xsl:text>&#xa;</xsl:text>
-
- <xsl:if test="tei:respStmt">
- <xsl:for-each select="tei:respStmt">
- <xsl:call-template name="format">
- <xsl:with-param name="txt" select="normalize-space(concat(tei:name, ': ', tei:resp))"/>
- <xsl:with-param name="width" select="$width"/>
- <xsl:with-param name="start" select="string-length(tei:name) + 3"/>
- </xsl:call-template>
- </xsl:for-each>
- <xsl:text>&#xa;</xsl:text>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="tei:extent">
- <xsl:text>Size: </xsl:text>
- <xsl:value-of select="."/>
- <xsl:text>&#xa;&#xa;</xsl:text>
- </xsl:template>
-
- <xd:doc>I understand this is needed for cases where we merely redistribute stuff.</xd:doc>
- <xsl:template match="tei:publisher">
- <xsl:value-of select="concat('Publisher: ',.,'.&#xa;')"/>
- </xsl:template>
-
- <xd:doc>For upstream publishers, I guess.</xd:doc>
- <xsl:template match="tei:publicationStmt/tei:date">
- <xsl:value-of select="concat('Publication date: ',.,'.&#xa;')"/>
- </xsl:template>
-
- <xd:doc>Shouldn't this always be the FreeDict URL?</xd:doc>
- <xsl:template match="tei:pubPlace">
- <xsl:value-of select="concat('Published at: ',tei:ref,'&#xa;')"/>
- </xsl:template>
-
- <xsl:template match="tei:availability">
- <xsl:variable name="spaced_ps">
- <xsl:for-each select="tei:p">
- <xsl:value-of select="concat(.,' ')"/>
- </xsl:for-each>
- </xsl:variable>
- <xsl:text>&#xa;&#xa;Availability:&#xa;&#xa; </xsl:text>
- <xsl:call-template name="format">
- <xsl:with-param name="txt" select="normalize-space($spaced_ps)"/>
- <xsl:with-param name="width" select="$width"/>
- <xsl:with-param name="start" select="2"/>
- </xsl:call-template>
- <xsl:text>&#xa;</xsl:text>
- </xsl:template>
-
- <xsl:template match="tei:publicationStmt">
- <xsl:apply-templates/>
- <xsl:text>&#xa;</xsl:text>
- </xsl:template>
-
- <xsl:template match="tei:seriesStmt">
- <xsl:text>Series: </xsl:text>
- <xsl:value-of select="tei:title"/>
- <xsl:text>&#xa;&#xa;</xsl:text>
- </xsl:template>
-
- <xsl:template match="tei:notesStmt">
- <xsl:text>Notes:&#xa;&#xa;</xsl:text>
- <xsl:apply-templates/>
- <xsl:text>&#xa;</xsl:text>
- </xsl:template>
-
- <xsl:template match="tei:teiHeader//tei:note">
- <xsl:text> * </xsl:text>
- <xsl:if test="@type and (@type = 'status')">
- <xsl:text>Database Status: </xsl:text>
- </xsl:if>
- <xsl:call-template name="format">
- <xsl:with-param name="txt" select="normalize-space()"/>
- <xsl:with-param name="width" select="$width"/>
- <xsl:with-param name="start" select="3"/>
- </xsl:call-template>
- <xsl:text>&#xa;</xsl:text>
- </xsl:template>
-
- <xsl:template match="tei:sourceDesc">
- <xsl:text>Source(s):&#xa;&#xa; </xsl:text>
- <xsl:variable name="sdtext">
- <xsl:apply-templates/>
- </xsl:variable>
- <xsl:call-template name="format">
- <xsl:with-param name="txt" select="normalize-space($sdtext)"/>
- <xsl:with-param name="width" select="$width"/>
- <xsl:with-param name="start" select="2"/>
- </xsl:call-template>
- <xsl:text>&#xa;</xsl:text>
- </xsl:template>
-
- <xsl:template match="tei:p">
- <xsl:text> </xsl:text>
- <xsl:apply-templates/>
- <xsl:text>&#xa;&#xa;</xsl:text>
- </xsl:template>
-
- <xsl:template match="tei:ptr">
- <xsl:value-of select="@target"/>
- </xsl:template>
-
- <xsl:template match="tei:revisionDesc">
- <xsl:text>Changelog:&#xa;&#xa;</xsl:text>
- <xsl:if test="string-length($current-date)>0">
- <!-- Add conversion timestamp -->
- <xsl:text> * </xsl:text>
- <xsl:value-of select="$current-date"/>
- <xsl:text>: Conversion of the TEI source file into c5 format.</xsl:text>
- <xsl:text>&#xa;</xsl:text>
- </xsl:if>
- <xsl:apply-templates/>
- </xsl:template>
-
- <xsl:template match="tei:change">
- <xsl:variable name="when">
- <xsl:choose>
- <xsl:when test="tei:date">
- <xsl:value-of select="tei:date"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="@when"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="who">
- <xsl:choose>
- <xsl:when test="tei:name">
- <xsl:value-of select="tei:name[1]"/>
- </xsl:when>
- <xsl:when test="@who">
- <xsl:variable name="who-attr" select="@who"/>
- <xsl:variable name="name-elem"
- select="/tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:respStmt/tei:name[@xml:id = substring-after($who-attr,'#')]"/>
- <xsl:choose>
- <xsl:when test="$name-elem">
- <xsl:value-of select="$name-elem"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$who-attr"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- </xsl:choose>
- </xsl:variable>
- <xsl:value-of select="concat(' * ',$when,' ',$who)"/>
-
- <!-- this is for the version information -->
- <xsl:if test="@n">
- <xsl:text> </xsl:text>
- <xsl:value-of select="concat('ver. ',@n)"/>
- </xsl:if>
- <xsl:text>:&#xa;</xsl:text>
- <xsl:apply-templates mode="changelog"/>
-
- </xsl:template>
-
- <!-- we pull these in separately -->
- <xsl:template mode="changelog" match="tei:*[1][local-name() = 'date']"/>
- <xsl:template mode="changelog" match="tei:name[1]"/>
-
- <xsl:template mode="changelog" match="text()[string-length(normalize-space()) > 0]">
- <xsl:variable name="stuff">
- <xsl:choose>
- <xsl:when test="substring(.,1,2)=': '">
- <xsl:value-of select="substring-after(.,': ')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="."/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:call-template name="format">
- <xsl:with-param name="txt" select="concat(' ',normalize-space($stuff))"/>
- <xsl:with-param name="width" select="$width"/>
- <xsl:with-param name="start" select="3"/>
- </xsl:call-template>
- </xsl:template>
-
- <!-- if the 'change' element has all three attrs: @n, @who and @when set, do not process 'head' -->
- <xsl:template match="tei:list" mode="changelog">
- <xsl:variable name="indent" select="count(ancestor-or-self::tei:list)*3"/>
- <xsl:if test="tei:head and not(string-length(ancestor::tei:change[1]/@n) &gt; 0 and
- string-length(ancestor::tei:change[1]/@who) &gt; 0 and
- string-length(ancestor::tei:change[1]/@when) &gt; 0)">
- <xsl:call-template name="format">
- <xsl:with-param name="txt" select="concat(' ',normalize-space(tei:head))"/>
- <xsl:with-param name="width" select="$width"/>
- <xsl:with-param name="start" select="$indent"/>
- </xsl:call-template>
- <!--<xsl:text>&#xa;</xsl:text>-->
- </xsl:if>
- <xsl:for-each select="tei:item">
- <xsl:variable name="item-content">
- <xsl:choose>
- <xsl:when test="tei:list">
- <xsl:apply-templates select="tei:list/preceding-sibling::tei:*|text()"/>
- <!-- this is obviously a kludge: I assume that a nested <list/> is always the last element in an <item/> -->
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="tei:*|text()"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:call-template name="format">
- <xsl:with-param name="txt"
- select="concat(substring(' ', 1, $indent),'* ',normalize-space($item-content))"/>
- <xsl:with-param name="width" select="$width"/>
- <xsl:with-param name="start" select="$indent+2"/>
- </xsl:call-template>
- <!--<xsl:text>&#xa;</xsl:text>-->
- <xsl:if test="tei:list">
- <xsl:apply-templates select="tei:list"/>
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
- <xsl:template match="tei:tagsDecl"/>
- <xsl:template match="tei:langUsage"/>
-
-</xsl:stylesheet>
diff --git a/xsl/re-indent.xsl b/xsl/re-indent.xsl
deleted file mode 100644
index c85dce3..0000000
--- a/xsl/re-indent.xsl
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
- xmlns:xd="http://www.pnp-software.com/XSLTdoc" exclude-result-prefixes="xd">
-
-<xd:doc type="stylesheet">
- <xd:short>Source XML reformatter</xd:short>
- <xd:detail>
- <p>This is just an indentity transform with an added instruction to reformat the source
- and add the XML declaration. Small and silly, but useful.</p>
- <p>Distributor: FreeDict.org (<a href="http://freedict.org/">http://freedict.org/</a>)</p>
- </xd:detail>
- <xd:copyright>public domain</xd:copyright>
- <xd:svnId>$Id:$</xd:svnId>
- </xd:doc>
-
- <xsl:output encoding="UTF-8" indent="yes" method="xml"/>
- <xsl:strip-space elements="*"/>
-
- <xsl:template match="node() | @*">
- <xsl:copy>
- <xsl:apply-templates select="node() | @*"/>
- </xsl:copy>
- </xsl:template>
-
-</xsl:stylesheet> \ No newline at end of file
diff --git a/xsl/sort.xsl b/xsl/sort.xsl
deleted file mode 100644
index ec498ea..0000000
--- a/xsl/sort.xsl
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<xsl:stylesheet
- version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns="http://www.tei-c.org/ns/1.0">
-
- <xsl:output encoding="UTF-8" indent="yes" />
- <xsl:strip-space elements="*"/>
-
- <xsl:template match="text()[not(string-length(normalize-space()))]"/>
-
- <!--
- If xsltproc did version 2
- <xsl:template match=":text/:body">
- -->
- <xsl:template match="*[local-name() = 'text']/*[local-name() = 'body']">
- <body>
- <xsl:apply-templates select="*[local-name() = 'entry']">
- <xsl:sort select="*[local-name() = 'form']/*[local-name() = 'orth']"/>
- </xsl:apply-templates>
- </body>
- </xsl:template>
-
- <xsl:template match='@*|node()'>
- <xsl:copy>
- <xsl:apply-templates select='@*|node()'/>
- </xsl:copy>
- </xsl:template>
-
-</xsl:stylesheet>
diff --git a/xsl/tei-wrapper.xml b/xsl/tei-wrapper.xml
deleted file mode 100644
index 572b16a..0000000
--- a/xsl/tei-wrapper.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE TEI.2 PUBLIC "-//TEI P4//DTD Main DTD Driver File//EN" "http://www.tei-c.org/P4X/DTD/tei2.dtd" [
-
-<!--
-
- This file is intended to be used after a TEI file was transformed with
- group-homographs.xsl to get back the default internal DTD subset which cannot
- be output with XSLT.
-
- -->
-
-<!ENTITY e SYSTEM "grouped.tei">
-<!ENTITY % TEI.dictionaries "INCLUDE">
-<!ENTITY % TEI.XML "INCLUDE">
-<!ENTITY % TEI.linking "INCLUDE">
-<!ATTLIST xptr url CDATA #IMPLIED>
-<!ATTLIST xref url CDATA #IMPLIED>
-]>
-<TEI.2>&e;</TEI.2>
diff --git a/xsl/tei2c5.xsl b/xsl/tei2c5.xsl
deleted file mode 100644
index 6abd140..0000000
--- a/xsl/tei2c5.xsl
+++ /dev/null
@@ -1,123 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- This stylesheet converts a TEI dictionary file
- into the c5 format suitable to be processed
- by 'dictfmt -c5' -->
-<!-- $Id$ -->
-
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:tei="http://www.tei-c.org/ns/1.0" version="1.0"
- xmlns:xd="http://www.pnp-software.com/XSLTdoc">
-
- <xsl:import href="inc/teiheader2txt.xsl"/>
- <xsl:import href="inc/teientry2txt.xsl"/>
-
- <xsl:output method="text" omit-xml-declaration="yes" encoding="UTF-8"/>
-
- <xsl:strip-space elements="*"/>
-
- <xsl:variable name="stylesheet-main_svnid">$Id$</xsl:variable>
-
- <!-- "main()" function -->
- <xsl:template match="/">
- <xsl:call-template name="t00-database-info"/>
- <xsl:call-template name="t00-database-short"/>
- <xsl:call-template name="t00-database-url"/>
- <xsl:apply-templates select="tei:TEI/tei:text/tei:body//tei:entry" mode="c5"/>
- </xsl:template>
-
- <xsl:template name="t00-database-info">
- <xsl:text>_____&#x0A;&#x0A;</xsl:text>
- <xsl:text>00-database-info&#x0A;</xsl:text>
- <xsl:apply-templates select="tei:TEI/tei:teiHeader"/>
- <xsl:apply-templates select="tei:TEI/tei:text/tei:front"/>
- </xsl:template>
-
- <xsl:template name="t00-database-short">
- <xsl:text>_____&#x0A;&#x0A;</xsl:text>
- <xsl:text>00-database-short&#x0A;</xsl:text>
- <xsl:value-of
- select="concat(tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title,
- ' ver. ',tei:TEI/tei:teiHeader/tei:fileDesc/tei:editionStmt/tei:edition)"/>
- <xsl:text>&#x0A;</xsl:text>
- </xsl:template>
-
- <xd:doc>Use either the ref of type='home' or possibly make a mistake and use the first ref under sourceDesc.</xd:doc>
- <xsl:template name="t00-database-url">
- <xsl:variable name="the_url">
- <xsl:value-of
- select="tei:TEI/tei:teiHeader/tei:fileDesc/tei:sourceDesc//tei:ref[@type='home']/@target |
- tei:TEI/tei:teiHeader/tei:fileDesc/tei:sourceDesc//tei:ref[1]/@target"/>
- </xsl:variable>
-
- <xsl:if test="string-length($the_url)>0"> <!-- only executed if url present -->
- <xsl:text>_____&#x0A;&#x0A;</xsl:text>
- <xsl:text>00-database-url&#x0A;</xsl:text>
- <xsl:value-of select="$the_url"/>
- <!-- old value-of:
- select="tei:TEI/tei:teiHeader/tei:fileDesc/tei:sourceDesc//tei:ref[@type='home']/@target |
- tei:TEI/tei:teiHeader/tei:fileDesc/tei:sourceDesc//tei:ref[1]/@target"/>
- -->
- <xsl:text>&#x0A;</xsl:text>
- </xsl:if>
- </xsl:template>
-
-
- <xsl:template match="tei:entry" mode="c5">
- <!-- mark start of a new c5 format definition -->
- <xsl:text>_____&#x0A;&#x0A;</xsl:text>
-
- <!-- take the contents of the orth elements and put them in the c5 headword
- line. headwords in that line will be put into the .index file by
- dictfmt. they are separated by %%%, so you will have to call dictfmt
- as 'dictfmt - -headword-separator %%%'
-
- (those two minus signs are separated by a space here, because
- otherwise an XML parser considers them as sgml comment end. for
- calling dictfmt you have to omit that space.) -->
- <xsl:for-each select="tei:form/tei:orth">
- <xsl:if test="1>string-length()">
- <xsl:message>Warning! Empty headword for entry #<xsl:value-of select="position()"/>
- </xsl:message>
- </xsl:if>
- <xsl:value-of select="."/>
- <xsl:if test="not(position()=last())">%%%</xsl:if>
- </xsl:for-each>
- <xsl:text>&#x0A;</xsl:text>
-
- <!-- output the usual text formatted entry -->
- <xsl:apply-templates select="."/>
-
- <xsl:text>&#x0A;</xsl:text>
- </xsl:template>
-
-<xd:doc>There is nothing special about the '=' characters, it's just a piece of quasi-aesthetic pseudomagic.</xd:doc>
-<xsl:template match="tei:front">
- =====================================================================
- <xsl:apply-templates mode="front"/>
- =====================================================================
-</xsl:template>
-
- <xsl:template match="tei:div|tei:table" mode="front">
- <xsl:apply-templates mode="front"/>
- </xsl:template>
-
-<xd:doc>An important note: tables within paragraphs will not render nice at all.</xd:doc>
- <xsl:template match="tei:p" mode="front">
- <xsl:text>&#x0A;</xsl:text>
- <xsl:apply-templates/>
- <xsl:text>&#x0A;</xsl:text>
- </xsl:template>
-
- <xsl:template match="tei:row" mode="front">
- <xsl:text>| </xsl:text>
- <xsl:apply-templates mode="front"/>
- <xsl:text>&#x0A;</xsl:text>
- </xsl:template>
-
- <xsl:template match="tei:cell" mode="front">
- <xsl:apply-templates/><xsl:text> </xsl:text>
- <!-- being extremely primitive here... no need for anything fancy -->
- </xsl:template>
-
-</xsl:stylesheet>
-
diff --git a/xsl/tei2dic.xsl b/xsl/tei2dic.xsl
deleted file mode 100644
index 4994e6a..0000000
--- a/xsl/tei2dic.xsl
+++ /dev/null
@@ -1,391 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-
-<!--
-
- This stylesheet converts a TEI dictionary into the format expected by
- the `xerox' tool of libbedic from http://bedic.sf.net.
- The expected TEI input needs all homographs grouped in <hom>
- elements. The support for the bedic format 0.9.6 is complete.
-
- For an overview of the context where this stylesheet is used see the
- FreeDict HOWTO.
-
- Limitations:
-
- * multiple <orth> elements are not supported
-
- * cross references are typeless and contain the english language
- specific "see also" instead of "synonyms:", "antonym(s):" etc.
- (typing could be added easily)
-
- * We don't have an escaping mechanism for literal backslashes.
-
-
- V0.1 Horst Eyermann 2002
-
- * This stylesheet was named tei2bedic.xsl, but not used
- in favor of `tei2dic.py'.
-
- * A limitation of XML is that it cannot represent NUL characters
- (NULL bytes). Even in XSLT/XPath no function to that end exists.
- So this stylesheet was essentially worthless and `tei2dic.py' was
- used to convert TEI files into the .dic format used by libbedic.
-
-
- V0.2 Michael Bunk 2005-May-25
-
- * This stylesheet is designed to supersede `tei2dic.py'.
-
- * The output of has to be filtered by small perl
- script. We should have done that from V0.1:
-
- perl -pi -e 's/\\0/\x00/gm; s/\\e/\e/gm;' <input.escapes >output.dic
-
- Due to the limitation of XML 1.0 not to be able to represent NUL and
- ESC characters and due to XSLT/XPath/EXSLT providing no function
- to output them, the perl code has to do the following translations
- (XML 1.1 allows ESC. But then xsltproc using libxml 20510
- doesn't support XML 1.1 yet):
-
- <\><0> -> <NUL>
- <\><e> -> <ESC>
-
- V0.3 Michael Bunk 2005-Jun-18
-
- * <trans> elements with multiple <tr> children are handled now,
- even though their usage is usually not in compliance with the
- TEI Guidelines.
-
- * Skipping of malformed entries that consist only of the headword,
- ie. that have only a single child and that is <form>.
-
- V0.4 Michael Bunk 2005-Jul-03
-
- * TEI <usg type="dom"> (domain) will be translated into
- bedic {ct} (category).
-
- * In case no char-precedence exists for a language, the
- Wikipedia-char-precedence coming with libbedic 0.9.6
- is used, modified by having the non-accented lowercase
- characters in their own equivalence classes preceding
- the uppercase characters. Another modification is that
- some characters 81-9f were removed.
-
- -->
-
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
- <xsl:output method="text" encoding="UTF-8"/>
-
- <xsl:template match="/">
- <xsl:apply-templates select="TEI.2/teiHeader"/>
- <xsl:apply-templates select="TEI.2/text/body/entry"/>
- </xsl:template>
-
- <xsl:variable name="version" select="0.4"/>
-
- <xsl:template name="new-line">
- <!-- To directly create bedic escaped newlines is not possible here,
- as ESC may not be represented in XML 1.0:
- <xsl:text>&#27;n</xsl:text>
-
- So we output "\en". The "\e" will have to be transformed
- into a real ESC char, eg. by a perl script. Then <ESC><n>
- will be a correctly encoded newline in the bedic format.
-
- To be complete, we should have an escaping mechanism for
- literal backslashes in place. But we do not.
- -->
- <xsl:text>\en</xsl:text>
- </xsl:template>
-
- <!-- Counter for commentXX. Has to be a global variable,
- so we can bind more frequently -->
- <xsl:variable name="n" select="2"/>
-
- <xsl:template match="/TEI.2/teiHeader">
- <!-- Output required Properties -->
- <xsl:text>id=</xsl:text>
- <xsl:value-of select="substring-before(fileDesc/titleStmt/title, ' ')"/>
- <xsl:text>&#10;</xsl:text>
-
- <!-- The used char-precedence depends on the language of the dictionary -->
- <xsl:text>char-precedence=</xsl:text>
- <xsl:choose>
- <xsl:when test="starts-with(fileDesc/titleStmt/title, 'German')">
- <xsl:text>{ -,!/.()?}{a}{AäÄ}{b}{B}{c}{C}</xsl:text>
- <xsl:text>{d}{D}{e}{E}{f}{F}{g}{G}{h}{H}{i}{I}{j}{J}{k}{K}</xsl:text>
- <xsl:text>{l}{L}{m}{M}{n}{N}{o}{OöÖ}{p}{P}{q}{Q}{r}{R}{s}{Sß}</xsl:text>
- <xsl:text>{t}{T}{u}{UüÜ}{v}{V}{w}{W}{x}{X}{y}{Y}{z}{Z}&#10;</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <!-- The warning is wrong for 'Serbo-Croat', as that contains a '-' -->
- <xsl:message>Warning: No preset char-precedence for <xsl:value-of
- select="substring-before(fileDesc/titleStmt/title, '-')"/> language.
- Using modified Wikipedia char-precedence.</xsl:message>
- <xsl:text>{a}{AäâàáåãæÀÁÂÃÄÅÆ}{b}{B}{c}{CçÇ}{d}{DðÐ}{e}{EèéêëÈÉÊ}</xsl:text>
- <xsl:text>{f}{F}{g}{G}{hH}{i}{IíîìïÍÎ}{j}{J}{k}{K}{l}{L£}{m}{Mµ}</xsl:text>
- <xsl:text>{n}{NñÑ}{o}{OôøòõóöÓÔÕÖ}{p}{P}{q}{Q}{r}{R}{s}{Sß}{t}{T}</xsl:text>
- <xsl:text>{u}{UüùúûÙÚÜ}{v}{V}{w}{W}{x}{X}{y}{Yýÿ}{z}{Z}0123456789</xsl:text>
- <xsl:text>-,;:!?/.`~'()}@$*\&amp;%=×ØÞ­´¸§°·²½±¡³ºª»«þ¼¿</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:text>description=</xsl:text>
- <xsl:value-of select="fileDesc/titleStmt/title"/>
- <xsl:text> </xsl:text>
- <xsl:value-of select="fileDesc/editionStmt/edition"/>
- <xsl:text>&#10;</xsl:text>
-
- <xsl:text>maintainer=</xsl:text>
- <xsl:value-of select="fileDesc/titleStmt/respStmt/name[../resp='Maintainer']"/>
- <xsl:text>&#10;</xsl:text>
-
- <xsl:text>copyright=Publisher: </xsl:text>
- <xsl:value-of select="fileDesc/publicationStmt/publisher"/>
- <xsl:text> Year: </xsl:text>
- <xsl:value-of select="fileDesc/publicationStmt/date"/>
- <xsl:text> Place: </xsl:text>
- <xsl:value-of select="fileDesc/publicationStmt/pubPlace"/>
- <!-- replace newlines with spaces and normalize space -->
- <xsl:value-of select="normalize-space(translate(fileDesc/publicationStmt/availability, '&#10;', ' '))"/>
- <xsl:text>&#10;</xsl:text>
-
- <!-- Fill the commentXX properties with some additional information -->
- <xsl:text>comment00=Dictionary Source URL: </xsl:text>
- <xsl:value-of select="fileDesc/sourceDesc//xptr/@url"/>
- <xsl:text>&#10;</xsl:text>
-
- <xsl:text>comment01=XSLT processor used for TEI->bedic conversion: </xsl:text>
- <xsl:value-of select="system-property('xsl:vendor')"/>
- <xsl:text>&#10;</xsl:text>
- <xsl:text>comment02=Stylesheet used for TEI->bedic conversion: V</xsl:text>
- <xsl:value-of select="$version"/>
- <xsl:text>&#10;</xsl:text>
-
- <xsl:for-each select="fileDesc/notesStmt/note">
- <xsl:text>comment</xsl:text>
- <xsl:value-of select="format-number($n+position(), '00')"/>
- <xsl:text>=Note: </xsl:text>
- <xsl:value-of select="normalize-space(translate(.,'&#10;', ' '))"/>
- <xsl:text>&#10;</xsl:text>
- </xsl:for-each>
- <xsl:variable name="n" select="$n+count(fileDesc/notesStmt/note)"/>
-
- <!-- Changelog -->
- <xsl:for-each select="revisionDesc/change">
- <xsl:text>comment</xsl:text>
- <xsl:value-of select="format-number($n + position(), '00')"/>
- <xsl:text>=ChangLog: </xsl:text>
- <xsl:value-of select="date"/>
- <xsl:text> </xsl:text>
- <xsl:value-of select="respStmt/name"/>
- <xsl:text>: </xsl:text>
- <xsl:value-of select="normalize-space(translate(item,'&#10;', ' '))"/>
- <xsl:text>&#10;</xsl:text>
- </xsl:for-each>
-
- <!-- End Mark of Header Section. This \0 has to be translated into
- NUL by a perl one-liner. -->
- <xsl:text>\0</xsl:text>
- </xsl:template>
-
- <!-- Templates to transform entries -->
- <xsl:template match="entry">
- <!-- Headword -->
- <xsl:choose>
- <xsl:when test="normalize-space(form/orth)=''">
- <xsl:message>Warning: Skipping entry without or with empty orth element(s).</xsl:message>
- </xsl:when>
- <xsl:when test="1 > count(*[name() != 'form'])">
- <xsl:message>Warning: Skipping entry with only form child(ren). form contents: '<xsl:value-of select='form'/>'</xsl:message>
- </xsl:when>
- <xsl:otherwise>
- <xsl:if test="count(form/orth)>1">
- <xsl:message>Warning: Ignoring additional orth elements in entry '<xsl:value-of
- select="form/orth"/><xsl:text>'.</xsl:text>
- </xsl:message>
- </xsl:if>
- <xsl:value-of select="form/orth[1]"/>
- <xsl:text>&#10;</xsl:text>
-
- <xsl:apply-templates select="hom"/>
-
- <!-- for entries without grouped senses (old-style FreeDict)
- as well as entries without <hom> -->
- <xsl:if test="count(gramGrp | sense | trans | def | eg | xr | note)>0">
- <xsl:call-template name="format-homograph">
- <xsl:with-param name="input" select="form | gramGrp | sense | trans | def | eg | xr | note"/>
- </xsl:call-template>
- </xsl:if>
-
- <!-- End Mark of entry -->
- <xsl:text>\0</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="hom">
- <xsl:call-template name="format-homograph">
- <xsl:with-param name="input" select="*"/>
- </xsl:call-template>
- </xsl:template>
-
- <!-- The parameter 'input' contains all child nodes
- to be formatted like inside a <hom> element -->
- <xsl:template name="format-homograph">
- <xsl:param name="input" select="*"/>
- <xsl:choose>
- <xsl:when test="1>count($input)">
- <xsl:message>Stylesheet assertion failed: Template 'format-homograph' called without input</xsl:message>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>{s}</xsl:text>
- <xsl:apply-templates select="$input[name()='gramGrp']"/>
-
- <xsl:apply-templates select="$input/pron"/>
-
- <!-- for entries with grouped senses -->
- <xsl:apply-templates select="$input[name()='sense']"/>
-
- <!-- for entries without grouped senses (old-style FreeDict) -->
- <xsl:call-template name="format-sense">
- <xsl:with-param name="input" select="$input[name()='trans' or name()='def' or name()='eg' or name()='xr' or name()='note']"/>
- </xsl:call-template>
-
- <xsl:text>{/s}</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="gramGrp">
- <xsl:text>{ps}</xsl:text>
- <xsl:value-of select="pos"/>
- <xsl:if test="gen">
- <xsl:text> </xsl:text>
- <xsl:value-of select="gen"/>
- </xsl:if>
- <xsl:if test="num">
- <xsl:text> </xsl:text>
- <xsl:value-of select="num"/>
- </xsl:if>
- <xsl:text>{/ps}</xsl:text>
- </xsl:template>
-
- <xsl:template match="pron">
- <xsl:text>{pr}</xsl:text><xsl:apply-templates/><xsl:text>{/pr}</xsl:text>
- </xsl:template>
-
- <xsl:template match="sense">
- <xsl:call-template name="format-sense">
- <xsl:with-param name="input" select="*"/>
- </xsl:call-template>
- </xsl:template>
-
- <!-- The parameter 'input' contains all child nodes
- to be formatted like inside a <sense> element -->
- <xsl:template name="format-sense">
- <xsl:param name="input" select="*"/>
- <xsl:if test="$input[name()='usg' or name()='trans' or name()='def' or name()='eg' or name()='xr' or name()='note']">
- <xsl:text>{ss}</xsl:text>
-
- <xsl:apply-templates select="$input[name()='usg']"/>
-
- <xsl:apply-templates select="$input[name()='trans' or name()='def']"/>
-
- <xsl:apply-templates select="$input[name()='note']"/>
-
- <xsl:if test="$input[name()='eg']">
- <xsl:text> -- </xsl:text>
- <xsl:apply-templates select="$input[name()='eg']"/>
- </xsl:if>
-
- <xsl:if test="count($input[name()='xr'])>0">
- <xsl:text> -- See also: </xsl:text>
- <xsl:for-each select="$input[name()='xr']">
- <xsl:apply-templates select="."/>
- <xsl:if test="position()!=last()">
- <xsl:text>, </xsl:text>
- </xsl:if>
- </xsl:for-each>
- </xsl:if>
-
- <xsl:text>{/ss}</xsl:text>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="usg[@type='dom']">
- <xsl:text>{ct}</xsl:text>
- <xsl:value-of select="."/>
- <xsl:text>.{/ct} </xsl:text>
- </xsl:template>
-
- <xsl:template match="trans">
- <!-- We have to handle multiple <tr> inside trans, because the old
- style encoded TEI files have this. Actually <trans> is meant only
- to group information related to a single translation eqivalent,
- while each translation equivalent should reside inside its own
- <trans>.
- -->
- <xsl:for-each select="tr">
- <xsl:value-of select="."/>
- <xsl:if test="not(position()=last())">, </xsl:if>
- </xsl:for-each>
-
- <!-- the gender of nouns in the destination language might be of interest
- (not in English, but in German, French etc.) -->
- <xsl:if test="gen"> (<xsl:value-of select="gen"/>)</xsl:if>
- <xsl:if test="not(position()=last())">, </xsl:if>
- </xsl:template>
-
- <xsl:template match="def">
- <xsl:value-of select="normalize-space(translate(., '&#10;', ' '))"/>
- </xsl:template>
-
- <xsl:template match="note">
- <!-- we don't want the timestamp of the last translator to appear
- I don't know why we have to use string(). I only know that
- without it, the test evaluates to true. -->
- <xsl:if test="string(@resp) != 'translator'">
- <xsl:text> (</xsl:text>
- <xsl:value-of select="normalize-space(translate(., '&#10;', ' '))"/>
- <xsl:text>)</xsl:text>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="eg">
- <xsl:text>{ex}"</xsl:text>
- <xsl:choose>
- <xsl:when test="contains(q,ancestor::entry/form/orth[1])">
- <!-- substitute headword in example by {hw/}
- goes wrong if
- * headword is capitalized eg. because it
- starts the example
- * headword is very short and is contained in
- other words eg. 'and' is contained in 'hand'
- -->
- <xsl:value-of select="substring-before(q,ancestor::entry/form/orth[1])"/>
- <xsl:text>{hw/}</xsl:text>
- <xsl:value-of select="substring-after(q,ancestor::entry/form/orth[1])"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="q"/>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:text>"</xsl:text>
-
- <xsl:if test="trans">
- <xsl:text> (</xsl:text>
- <xsl:value-of select="trans/tr"/>
- <xsl:text>)</xsl:text>
- </xsl:if>
- <xsl:text>{/ex}</xsl:text>
- </xsl:template>
-
- <xsl:template match="xr">
- <xsl:text>{sa}</xsl:text>
- <xsl:value-of select="ref"/>
- <xsl:text>{/sa}</xsl:text>
- </xsl:template>
-
-</xsl:stylesheet>
-
diff --git a/xsl/tei2dictxml.xsl b/xsl/tei2dictxml.xsl
deleted file mode 100644
index 9f2f892..0000000
--- a/xsl/tei2dictxml.xsl
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-
-<xsl:stylesheet
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
- <xsl:output method="xml" omit-xml-declaration="yes" encoding="UTF-8"/>
-
-
- <xsl:template match="text()">
- <xsl:value-of select="normalize-space(.)"/>
- </xsl:template>
-
-
- <xsl:template match="teiHeader">
- </xsl:template>
-
- <xsl:template match="orth">
- <xsl:apply-templates/>
- </xsl:template>
-
-
-
-<xsl:template match="TEI.2">
-<xsl:apply-templates/>
-</xsl:template>
-
-<xsl:template match="text">
-<xsl:apply-templates/>
-</xsl:template>
-
-<xsl:template match="body">
-<xsl:apply-templates/>
-</xsl:template>
-
-<xsl:template match="entry"><xsl:text>&#x0A;_____&#x0A;&#x0A;</xsl:text><xsl:value-of select="form/orth"/>&#x0A;
-<xsl:text>&#x0A;&#x0A;</xsl:text><entry><xsl:apply-templates select='@* | node()'/></entry>
-</xsl:template>
-
-<xsl:template match='@* | node()'>
-<xsl:copy><xsl:apply-templates select='@* | node()'/></xsl:copy>
-</xsl:template>
-
-</xsl:stylesheet>
diff --git a/xsl/tei2txt.xsl b/xsl/tei2txt.xsl
deleted file mode 100644
index c232f4b..0000000
--- a/xsl/tei2txt.xsl
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
-
-This stylesheet is an alternative to tei2c5.xsl. It was written to convert
-single entry chunks (or the header chunk) into plain text. Is is to be used
-with 'xmltei2xmldict.pl'.
-
--->
-
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-
- <xsl:import href="inc/teiheader2txt.xsl"/>
- <xsl:import href="inc/teientry2txt.xsl"/>
- <xsl:output method="text"/>
-
-</xsl:stylesheet>
-