diff options
Diffstat (limited to 'latex/algorithm.xsl')
-rw-r--r-- | latex/algorithm.xsl | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/latex/algorithm.xsl b/latex/algorithm.xsl new file mode 100644 index 0000000..92f08ae --- /dev/null +++ b/latex/algorithm.xsl @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet + version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:alg="http://h4sp.planete-kraus.eu/ns/algorithm"> + + <xsl:import href="escape.xsl" /> + <xsl:import href="markup.xsl" /> + + <xsl:output method="text"/> + + <xsl:template match="alg:algorithmic"> + <xsl:text>\begin{algorithmic}
</xsl:text> + <xsl:apply-templates /> + <xsl:text>\end{algorithmic}
</xsl:text> + </xsl:template> + + <xsl:template match="alg:donnée"> + <xsl:text>\State \textbf{Donnée~:} </xsl:text> + <xsl:apply-templates /> + <xsl:text>
</xsl:text> + </xsl:template> + + <xsl:template match="alg:hyperparamètre"> + <xsl:text>\State \textbf{Hyperparamètre~:} </xsl:text> + <xsl:apply-templates /> + <xsl:text>
</xsl:text> + </xsl:template> + + <xsl:template match="alg:modèle"> + <xsl:text>\State \textbf{Modèle~:} </xsl:text> + <xsl:apply-templates /> + <xsl:text>
</xsl:text> + </xsl:template> + + <xsl:template match="alg:résultat"> + <xsl:text>\State \textbf{Résultat~:} </xsl:text> + <xsl:apply-templates /> + <xsl:text>
</xsl:text> + </xsl:template> + + <xsl:template match="alg:state[count(ancestor::alg:state) = 0]" mode="state-index"> + <xsl:value-of select="1 + count(preceding-sibling::alg:state)" /> + </xsl:template> + + <xsl:template match="alg:state[count(ancestor::alg:state) = 1]" mode="state-index"> + <xsl:apply-templates mode="state-index" select="ancestor::alg:state" /> + <xsl:text>.</xsl:text> + <xsl:value-of select="substring('abcdefghijklmnopqrstuvwxyz', 1 + count(preceding-sibling::alg:state), 1)" /> + </xsl:template> + + <xsl:template match="alg:state"> + <xsl:text>\State </xsl:text> + <xsl:apply-templates mode="state-index" select="." /> + <xsl:text>. </xsl:text> + <xsl:apply-templates /> + <xsl:text>
</xsl:text> + </xsl:template> +</xsl:stylesheet> |