formatting
This commit is contained in:
parent
e7daad3f95
commit
3267a980b3
2 changed files with 170 additions and 183 deletions
49
traceur.xsl
49
traceur.xsl
|
@ -18,9 +18,9 @@
|
||||||
paramètres -->
|
paramètres -->
|
||||||
<xsl:call-template name="process-commands">
|
<xsl:call-template name="process-commands">
|
||||||
<xsl:with-param name="commands" select="*" />
|
<xsl:with-param name="commands" select="*" />
|
||||||
<xsl:with-param name="x"
|
<xsl:with-param name="x" select="$initial-x" />
|
||||||
select="$initial-x" />
|
<xsl:with-param
|
||||||
<xsl:with-param name="y" select="$initial-y" />
|
name="y" select="$initial-y" />
|
||||||
<xsl:with-param
|
<xsl:with-param
|
||||||
name="angle" select="$initial-angle" />
|
name="angle" select="$initial-angle" />
|
||||||
<xsl:with-param name="states" select="()" />
|
<xsl:with-param name="states" select="()" />
|
||||||
|
@ -29,14 +29,14 @@
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<!-- Template récursif pour traiter les commandes individuelles -->
|
<!-- Template récursif pour traiter les commandes individuelles -->
|
||||||
<xsl:template
|
<xsl:template
|
||||||
name="process-commands">
|
name="process-commands">
|
||||||
<xsl:param name="commands" />
|
<xsl:param name="commands" />
|
||||||
<xsl:param name="x" />
|
<xsl:param name="x" />
|
||||||
<xsl:param name="y" />
|
<xsl:param name="y" />
|
||||||
|
<xsl:param name="angle" />
|
||||||
<xsl:param
|
<xsl:param
|
||||||
name="angle" />
|
name="states" />
|
||||||
<xsl:param name="states" />
|
|
||||||
|
|
||||||
<!-- Si il reste des commandes à traiter -->
|
<!-- Si il reste des commandes à traiter -->
|
||||||
<xsl:if test="$commands">
|
<xsl:if test="$commands">
|
||||||
|
@ -61,16 +61,14 @@
|
||||||
y="{format-number($new-y, '#.######')}" />
|
y="{format-number($new-y, '#.######')}" />
|
||||||
<!-- Rappel récursif du template avec la mise à jour des coordonnées et des
|
<!-- Rappel récursif du template avec la mise à jour des coordonnées et des
|
||||||
commandes restantes -->
|
commandes restantes -->
|
||||||
<xsl:call-template
|
<xsl:call-template name="process-commands">
|
||||||
name="process-commands">
|
|
||||||
<xsl:with-param name="commands" select="$commands[position() > 1]" />
|
<xsl:with-param name="commands" select="$commands[position() > 1]" />
|
||||||
<xsl:with-param
|
<xsl:with-param
|
||||||
name="x" select="$new-x" />
|
name="x" select="$new-x" />
|
||||||
<xsl:with-param name="y" select="$new-y" />
|
<xsl:with-param name="y" select="$new-y" />
|
||||||
<xsl:with-param
|
<xsl:with-param
|
||||||
name="angle" select="$angle" />
|
name="angle" select="$angle" />
|
||||||
<xsl:with-param name="states"
|
<xsl:with-param name="states" select="$states" />
|
||||||
select="$states" />
|
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<!-- Si la commande est un turn -->
|
<!-- Si la commande est un turn -->
|
||||||
|
@ -88,8 +86,7 @@
|
||||||
<xsl:with-param name="y" select="$y" />
|
<xsl:with-param name="y" select="$y" />
|
||||||
<xsl:with-param
|
<xsl:with-param
|
||||||
name="angle" select="$new-angle" />
|
name="angle" select="$new-angle" />
|
||||||
<xsl:with-param name="states"
|
<xsl:with-param name="states" select="$states" />
|
||||||
select="$states" />
|
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<!-- Si la commande est un MOVE -->
|
<!-- Si la commande est un MOVE -->
|
||||||
|
@ -109,29 +106,23 @@
|
||||||
y="{format-number($new-y, '#.######')}" />
|
y="{format-number($new-y, '#.######')}" />
|
||||||
<!-- Rappel récursif du template avec la mise à jour des coordonnées et des
|
<!-- Rappel récursif du template avec la mise à jour des coordonnées et des
|
||||||
commandes restantes -->
|
commandes restantes -->
|
||||||
<xsl:call-template
|
<xsl:call-template name="process-commands">
|
||||||
name="process-commands">
|
|
||||||
<xsl:with-param name="commands" select="$commands[position() > 1]" />
|
<xsl:with-param name="commands" select="$commands[position() > 1]" />
|
||||||
<xsl:with-param
|
<xsl:with-param
|
||||||
name="x" select="$new-x" />
|
name="x" select="$new-x" />
|
||||||
<xsl:with-param name="y" select="$new-y" />
|
<xsl:with-param name="y" select="$new-y" />
|
||||||
<xsl:with-param
|
<xsl:with-param
|
||||||
name="angle" select="$angle" />
|
name="angle" select="$angle" />
|
||||||
<xsl:with-param name="states"
|
<xsl:with-param name="states" select="$states" />
|
||||||
select="$states" />
|
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<!--Si
|
<!-- Si la commande est un store -->
|
||||||
la commande est un store -->
|
|
||||||
<xsl:when test="local-name($current-command) = 'store'">
|
<xsl:when test="local-name($current-command) = 'store'">
|
||||||
<!--On
|
<!-- On enregistre le nouvelle état-->
|
||||||
enregistre le nouvelle état-->
|
<xsl:variable name="new-state">
|
||||||
<xsl:variable
|
|
||||||
name="new-state">
|
|
||||||
<state x="{$x}" y="{$y}" angle="{$angle}" />
|
<state x="{$x}" y="{$y}" angle="{$angle}" />
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
<!--On
|
<!-- On l'ajoute au précédent -->
|
||||||
l'ajoute au précédent -->
|
|
||||||
<xsl:variable
|
<xsl:variable
|
||||||
name="new-states" select="($states, $new-state)" />
|
name="new-states" select="($states, $new-state)" />
|
||||||
<xsl:call-template
|
<xsl:call-template
|
||||||
|
@ -142,15 +133,12 @@
|
||||||
<xsl:with-param name="y" select="$y" />
|
<xsl:with-param name="y" select="$y" />
|
||||||
<xsl:with-param
|
<xsl:with-param
|
||||||
name="angle" select="$angle" />
|
name="angle" select="$angle" />
|
||||||
<xsl:with-param name="states"
|
<xsl:with-param name="states" select="$new-states" />
|
||||||
select="$new-states" />
|
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<!--Si
|
<!-- Si la commande est un restore et que au moins 1 état est enregistré : -->
|
||||||
la commande est un restore et que au moins 1 état est enregistré : -->
|
|
||||||
<xsl:when test="local-name($current-command) = 'restore' and count($states)>=1">
|
<xsl:when test="local-name($current-command) = 'restore' and count($states)>=1">
|
||||||
<!--On
|
<!-- On séléctionne notre state-->
|
||||||
séléctionne notre state-->
|
|
||||||
<xsl:variable
|
<xsl:variable
|
||||||
name="state" select="$states/state[1]" />
|
name="state" select="$states/state[1]" />
|
||||||
<xsl:variable
|
<xsl:variable
|
||||||
|
@ -170,7 +158,6 @@
|
||||||
select="$remaining-states" />
|
select="$remaining-states" />
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
Reference in a new issue