4 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5 xmlns:tml="http://helm.cs.unibo.it/2002/TML"
6 xmlns:m="http://www.w3.org/1998/Math/MathML"
9 <xsl:output method="text" indent="yes"/>
11 <xsl:param name="id" select="/.."/>
13 <xsl:template match="/">
16 <xsl:apply-templates select="descendant::*[@id=$id]"/>
19 <xsl:apply-templates select="*"/>
24 <xsl:template match="tml:tex">
25 <xsl:apply-templates select="*"/>
28 <xsl:template match="tml:math">
30 <xsl:when test="@display='1'">$$<xsl:apply-templates select="*"/>$$</xsl:when>
31 <xsl:otherwise>$<xsl:apply-templates select="*"/>$</xsl:otherwise>
35 <xsl:template match="tml:i">
37 <xsl:when test="@name">\<xsl:value-of select="@name"/>
38 <xsl:if test="parent::tml:g and following-sibling::tml:i"><xsl:value-of select="' '"/></xsl:if>
40 <xsl:when test="string-length(@val)=1"><xsl:value-of select="@val"/></xsl:when>
41 <xsl:otherwise>{\it <xsl:value-of select="@val"/>}</xsl:otherwise>
45 <xsl:template match="tml:n">
47 <xsl:when test="@name">\<xsl:value-of select="@name"/>
48 <xsl:if test="parent::tml:g and following-sibling::tml:i"><xsl:value-of select="' '"/></xsl:if>
50 <xsl:when test="string-length(@val)=1"><xsl:value-of select="@val"/></xsl:when>
51 <xsl:otherwise>{\rm <xsl:value-of select="@val"/>}</xsl:otherwise>
55 <xsl:template match="tml:o">
57 <xsl:when test="@name">\<xsl:value-of select="@name"/>
58 <xsl:if test="parent::tml:g and following-sibling::tml:i"><xsl:value-of select="' '"/></xsl:if>
60 <xsl:when test="string-length(@val)=1"><xsl:value-of select="@val"/></xsl:when>
61 <xsl:otherwise><xsl:value-of select="@val"/></xsl:otherwise>
65 <xsl:template match="tml:sb">
67 <xsl:when test="@under='1'">
68 <xsl:apply-templates select="*[1]"/>__<xsl:apply-templates select="*[2]"/>
71 <xsl:apply-templates select="*[1]"/>_<xsl:apply-templates select="*[2]"/>
76 <xsl:template match="tml:sp">
78 <xsl:when test="@over='1'">
79 <xsl:apply-templates select="*[1]"/>^^<xsl:apply-templates select="*[2]"/>
82 <xsl:apply-templates select="*[1]"/>^<xsl:apply-templates select="*[2]"/>
87 <xsl:template match="tml:g[@id]">{<xsl:apply-templates select="*"/>}</xsl:template>
89 <xsl:template match="tml:g[count(*)>1]">{<xsl:apply-templates select="*"/>}</xsl:template>
91 <xsl:template match="tml:g">
92 <xsl:apply-templates select="*"/>
95 <xsl:template match="tml:row">
96 <xsl:apply-templates select="cell"/>\cr </xsl:template>
98 <xsl:template match="tml:cell">
99 <xsl:apply-templates select="*"/>
100 <xsl:if test="position() < last()">&</xsl:if>
103 <!--/// CONTROL SEQUENCES ///-->
105 <xsl:template match="tml:c[*[1][self::tml:g[@left-open='1']]]">
106 <xsl:apply-templates select="*[1]"/>\<xsl:value-of select="@name"/>
107 <xsl:if test="*[2][self::tml:i]"><xsl:value-of select="' '"/></xsl:if>
108 <xsl:apply-templates select="*[position()>1]"/>
111 <xsl:template match="tml:c">\<xsl:value-of select="@name"/>
112 <xsl:if test="*[1][self::tml:i]"><xsl:value-of select="' '"/></xsl:if>
113 <xsl:apply-templates select="*"/>