TEI stylesheet for converting Word docx files to TEI
This software is dual-licensed:
1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
Unported License http://creativecommons.org/licenses/by-sa/3.0/
2. http://www.opensource.org/licenses/BSD-2-Clause
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
This software is provided by the copyright holders and contributors
"as is" and any express or implied warranties, including, but not
limited to, the implied warranties of merchantability and fitness for
a particular purpose are disclaimed. In no event shall the copyright
holder or contributors be liable for any direct, indirect, incidental,
special, exemplary, or consequential damages (including, but not
limited to, procurement of substitute goods or services; loss of use,
data, or profits; or business interruption) however caused and on any
theory of liability, whether in contract, strict liability, or tort
(including negligence or otherwise) arising in any way out of the use
of this software, even if advised of the possibility of such damage.
removed 2010-03-15, seems to screw up formulae
<doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
<desc>
<p> A tab in a <formula>? no. </p>
</desc>
</doc>
<xsl:template match="tei:formula//tei:g[@ref='x:tab']" mode="pass2"/>
Template
tei:hi[@rend='footnote_reference' and count(*)=1 and tei:note]pass2
Namespace
No namespace
Match
tei:hi[@rend='footnote_reference' and count(*)=1 and tei:note]
Mode
pass2
Import precedence
6
Priority
99
Source
<xsl:template match="tei:hi[@rend='footnote_reference' and count(*)=1 and tei:note]" mode="pass2" priority="99"><xsl:apply-templates mode="pass2"/></xsl:template>
<xsl:template match="tei:hi[@rend]" mode="pass2"><xsl:variable name="r" select="@rend"/><xsl:choose><xsl:when test="count(parent::tei:speaker/*)=1 and not (parent::tei:speaker/text())"><xsl:apply-templates/></xsl:when><xsl:when test="parent::tei:head and .=' '"/><xsl:when test="not(*) and string-length(.)=0"/><xsl:when test="parent::tei:item/parent::tei:list[@type='gloss'] and tei:g[@ref='x:tab']"/><xsl:when test="preceding-sibling::node()[1][self::tei:hi[@rend=$r]]"></xsl:when><xsl:when test="preceding-sibling::node()[1][self::tei:seg and .=' '] and preceding-sibling::node()[2][self::tei:hi[@rend=$r]]"></xsl:when><xsl:when test="@rend='bold' and .=' '"><xsl:text></xsl:text></xsl:when><xsl:when test="@rend='italic' and .=' '"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:variable name="ename"><xsl:choose><xsl:when test="@rend='italic' and ancestor::tei:bibl">title</xsl:when><xsl:otherwise>hi</xsl:otherwise></xsl:choose></xsl:variable><xsl:element name="{$ename}"><xsl:copy-of select="@*"/><xsl:apply-templates mode="pass2"/><xsl:call-template name="nextHi"><xsl:with-param name="r" select="$r"/></xsl:call-template></xsl:element></xsl:otherwise></xsl:choose></xsl:template>