mirror: 初始快照

This commit is contained in:
Li_Feiyu committed 2026-10-02 22:51:03 +08:00
commit bf87c99809
1011 files changed
+18247530

No files matched your search

+133
View File
@@ -0,0 +1,133 @@
<?xml version='1.0' encoding='UTF-8'?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- Helper functions to manage indentation -->
<!-- You need at least Version 1.0 of Sablotron from August 8, 2003
(ChangeLog says "fixed a bug of default NS in imported/included templates")
if you get error messages like:
Error [code:52] [URI:file:tools/xsl/inc/teiheader2txt.xsl] [line:10]
[node:element '<xsl:call-template>'] called nonexistent rule 'format'
This bug appears at least in sabcmd 0.98 (April 7, 2003).
-->
<!-- 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>
<!-- This template returns a number, (0 <= return value <= $width) or $def.
It seems to look for the column of the last space in $txt, smaller than $width.
If no space found, $def is returned. -->
<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>
<!-- This template returns a number ($width <= return value <= string-length($txt)).
It seems to look for the column of the next space in $txt after $width. If no
space found, string-length($txt) is returned. It does primitive recursion over $width. -->
<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>
<!-- Use the 'format' template per default for outputting text nodes -
<xsl:template match="text()">
<xsl:call-template name="format">
<xsl:with-param name="txt" select="."/>
<xsl:with-param name="width" select="70"/>
<xsl:with-param name="start" select="0"/>
</xsl:call-template>
</xsl:template>
-->
</xsl:stylesheet>
+158
View File
@@ -0,0 +1,158 @@
<?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" version="1.0">
<xsl:include href="indent.xsl"/>
<!--<xsl:variable name="stylesheet-cvsid">
$Id: teientry2txt.xsl,v 1.15 2009/11/09 03:47:52 bansp Exp $
</xsl:variable>
added the variable but then uncommented it, because it would get priority
over the one defined in the header module; not sure if that was indended -->
<!-- the addition of P5 stuff relies on the absolute complementarity between
null-spaced elements (P4) and elements in the TEI namespace (P5) -->
<xsl:strip-space elements="*"/>
<!-- 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... 13-apr-09-->
<!-- Entrées dont il faut vérifier la conversion :
korr- pour le tag <def>, brulu pour le subtype litt, azgwerzh pour le <sense><cit>,
-->
<!-- TEI entry specific templates -->
<xsl:template match="tei:entry">
<xsl:apply-templates select="tei:form"/>
<xsl:apply-templates select="tei:sense"/>
</xsl:template>
<xsl:template match="tei:form">
<xsl:apply-templates select="tei:orth"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="tei:lbl"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="tei:pos"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="tei:gen"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="tei:number"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="tei:form"/>
<!-- form[@type='infl'] ? -->
</xsl:template>
<xsl:template match="tei:sense">
<xsl:text>&#xa;</xsl:text>
<xsl:apply-templates select="tei:usg"/>
<xsl:apply-templates select="tei:lbl"/>
<xsl:apply-templates select="tei:def"/>
<xsl:apply-templates select="tei:cit"/><!--
<xsl:apply-templates select="tei:cit[@type='translation']"/>
<xsl:text>&#xa;</xsl:text>
<xsl:apply-templates select="tei:cit[@type='example']"/>
<xsl:text>&#xa;</xsl:text>-->
</xsl:template>
<xsl:template match="tei:cit">
<xsl:choose>
<xsl:when test="@type ='translation'"> <xsl:apply-templates select="tei:cit[@type='translation']"/><xsl:text>&#xa;</xsl:text></xsl:when>
<xsl:when test="@type ='example'"> <xsl:apply-templates select="tei:cit[@type='example']"/><xsl:text>&#xa;</xsl:text></xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="tei:quote"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="tei:lbl"/>
<xsl:apply-templates select="tei:pos"/>
<xsl:text> </xsl:text><xsl:apply-templates select="tei:gen"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="tei:number"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="tei:cit[@type='translation']"/>
<!--<xsl:value-of select="."/> <xsl:text> </xsl:text> -->
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="tei:cit[@type='example']">
<xsl:text>&#xa;</xsl:text> <xsl:text> ● </xsl:text>
<xsl:apply-templates select="tei:usg"/>
<xsl:apply-templates select="tei:quote"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="tei:cit[@type='translation']"/>
</xsl:template>
<xsl:template match="tei:cit[@type='translation']">
<xsl:choose>
<xsl:when test="@subtype != 0">
<xsl:text> litt. </xsl:text>
<xsl:apply-templates select="tei:quote"/>
</xsl:when>
<xsl:otherwise>
<xsl:text> ↪ </xsl:text>
<xsl:apply-templates select="tei:quote"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="tei:lbl"/>
<xsl:apply-templates select="tei:pos"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="tei:gen"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="tei:number"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="tei:form[@type]"/>
<xsl:text> </xsl:text>
</xsl:otherwise>
</xsl:choose>
</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:def">
<xsl:value-of select="."/>
<xsl:text> </xsl:text>
</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:quote">
<!-- <xsl:value-of select="."/> -->
<xsl:apply-templates /> <!-- select="tei:form[@type='infl']"/>-->
</xsl:template>
<!-- template-->
<xsl:template match="tei:form[@type='infl'] | tei:pos | tei:number | tei:gen | tei:form[@type='plur'] | tei:form[@type='pastp']| tei:form[@type='sing']">
<xsl:copy>
<xsl:for-each select="node()">
<xsl:text> </xsl:text>
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:copy>
</xsl:template>
<xsl:template match="form[@type='infl'] | lbl">
<xsl:text>(</xsl:text>
<xsl:value-of select="."/>
<xsl:text>)</xsl:text>
</xsl:template>
<!-- caractères spéciaux — - ― • ◊ ● ○ ♦ -->
</xsl:stylesheet>
+276
View File
@@ -0,0 +1,276 @@
<?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"/>
<!-- Has to come from the shell, as XSLT/XPath 1.0 provide no
function to get current time/date -->
<xsl:param name="current-date"/>
<xsl:variable name="stylesheet-header_svnid">$Id: teiheader2txt.xsl 1095 2011-01-06 14:57:17Z bansp$</xsl:variable>
<!-- Using this stylesheet with Sablotron requires a version >=0.95,
because xsl:strip-space was implemented from that version on -->
<!--<xsl:strip-space elements="teiHeader fileDesc titleStmt respStmt editionStmt publicationStmt seriesStmt notesStmt revisionDesc TEI.2 TEI p sourceDesc availability encodingDesc"/>-->
<xsl:strip-space elements="*"/>
<!-- the addition of P5 stuff relies on the absolute complementarity between
null-spaced elements (P4) and elements in the TEI namespace (P5) -->
<!-- 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>
<xd:doc>Id #, currently we only use the SVN Id.</xd:doc>
<xsl:template match="tei:idno">
<xsl:value-of select="concat('ID# (',@type,'): ',.,'&#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:projectDesc">
<xsl:text>The Project:&#xa;&#xa; </xsl:text>
<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="2"/>
</xsl:call-template>
<xsl:text>&#xa;</xsl:text>
</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; Stylesheet ID: </xsl:text>
<xsl:value-of select="$stylesheet-header_svnid"/>
<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>
<!-- this is a horribly unreadable template that should definitely be rewritten -->
<!-- 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:stylesheet>
+123
View File
@@ -0,0 +1,123 @@
<?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: tei2c5.xsl 1289 2014-02-16 19:30:59Z humenda $ -->
<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: tei2c5.xsl 1289 2014-02-16 19:30:59Z humenda $</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>