]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/style/annotatedpres.xsl
Initial revision
[helm.git] / helm / style / annotatedpres.xsl
diff --git a/helm/style/annotatedpres.xsl b/helm/style/annotatedpres.xsl
new file mode 100644 (file)
index 0000000..511f915
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+
+<!--***********************************************************************--> 
+<!-- XSLT version 0.1 of annotated MathML content to MathML presentation:  -->
+<!-- First draft: March 29 2000, Claudio Sacerdoti Coen, Irene Schena      -->
+<!--***********************************************************************--> 
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                              xmlns:m="http://www.w3.org/1998/Math/MathML"
+                              xmlns:helm="http://www.cs.unibo.it/helm">
+
+<xsl:import href="mmlextension.xsl"/>
+
+<!-- ANNOTATION -->
+
+<xsl:template match="annotation">
+    <xsl:choose>
+    <xsl:when test=". = /">
+      <m:math><m:mrow helm:xref="{@helm:xref}"><xsl:apply-templates/></m:mrow></m:math>
+    </xsl:when>
+    <xsl:otherwise>
+     <m:mrow helm:xref="{@helm:xref}"><xsl:apply-templates/></m:mrow>
+    </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<xsl:template match="text()">
+ <xsl:variable name="text" select="normalize-space(.)"/>
+ <xsl:if test="$text != ''">
+  <m:mtext><xsl:value-of select="$text"/></m:mtext>
+ </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>