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:n"><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"/><xsl:value-of select="' '"/></xsl:when>
58 <xsl:when test="string-length(@val)=1"><xsl:value-of select="@val"/></xsl:when>
59 <xsl:otherwise><xsl:value-of select="@val"/></xsl:otherwise>
63 <xsl:template match="tml:sb">
65 <xsl:when test="@under='1'">
66 <xsl:apply-templates select="*[1]"/>__<xsl:apply-templates select="*[2]"/>
69 <xsl:apply-templates select="*[1]"/>_<xsl:apply-templates select="*[2]"/>
74 <xsl:template match="tml:sp">
76 <xsl:when test="@over='1'">
77 <xsl:apply-templates select="*[1]"/>^^<xsl:apply-templates select="*[2]"/>
80 <xsl:apply-templates select="*[1]"/>^<xsl:apply-templates select="*[2]"/>
85 <xsl:template match="tml:g[@id]">{<xsl:apply-templates select="*"/>}</xsl:template>
87 <xsl:template match="tml:g">
88 <xsl:apply-templates select="*"/>
91 <xsl:template match="tml:row">
92 <xsl:apply-templates select="cell"/>\cr </xsl:template>
94 <xsl:template match="tml:cell">
95 <xsl:apply-templates select="*"/>
96 <xsl:if test="position() < last()">&</xsl:if>
99 <!--/// CONTROL SEQUENCES ///-->
101 <xsl:template match="tml:c[*[1][self::tml:g[@left-open='1']]]">
102 <xsl:apply-templates select="*[1]"/>\<xsl:value-of select="@name"/>
103 <xsl:if test="*[2][self::tml:i]"><xsl:value-of select="' '"/></xsl:if>
104 <xsl:apply-templates select="*[position()>1]"/>
107 <xsl:template match="tml:c">\<xsl:value-of select="@name"/>
108 <xsl:if test="*[1][self::tml:i]"><xsl:value-of select="' '"/></xsl:if>
109 <xsl:apply-templates select="*"/>