format
This commit is contained in:
parent
db09746609
commit
d5aa66fc35
3 changed files with 15 additions and 20 deletions
|
@ -37,7 +37,6 @@
|
|||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
|
||||
<xs:complexType name="Interpretation">
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="InterpElement">
|
||||
|
@ -53,7 +52,6 @@
|
|||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
|
||||
|
||||
<xs:complexType name="Substitutions">
|
||||
<xs:sequence>
|
||||
<xs:element name="substitution" type="Substitution" maxOccurs="unbounded" />
|
||||
|
@ -86,5 +84,4 @@
|
|||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
</xs:schema>
|
||||
|
|
|
@ -19,5 +19,4 @@
|
|||
</xs:choice>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
</xs:schema>
|
||||
|
|
31
tortue.xsl
31
tortue.xsl
|
@ -18,19 +18,19 @@
|
|||
<!-- Substitution -->
|
||||
<xsl:template name="substitution">
|
||||
<xsl:param name="actuel" />
|
||||
<xsl:param name="n" />
|
||||
<xsl:param name="n" />
|
||||
<!-- Si on doit encore substituer -->
|
||||
<xsl:choose>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$n > 0">
|
||||
<!-- Applique la substitution -->
|
||||
<xsl:variable name="data">
|
||||
<xsl:variable name="data">
|
||||
<xsl:call-template name="Application">
|
||||
<xsl:with-param name="data" select="$actuel" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<!-- Appel récursif -->
|
||||
<xsl:call-template
|
||||
<xsl:call-template
|
||||
name="substitution">
|
||||
<xsl:with-param name="actuel" select="$data" />
|
||||
<xsl:with-param name="n" select="$n - 1" />
|
||||
|
@ -38,7 +38,7 @@
|
|||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- Interprétation -->
|
||||
<xsl:call-template name="Interpretation">
|
||||
<xsl:call-template name="Interpretation">
|
||||
<xsl:with-param name="data" select="$actuel" />
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
|
@ -48,8 +48,8 @@
|
|||
<!-- Applique la substitution -->
|
||||
<xsl:template name="Application">
|
||||
<xsl:param name="data" />
|
||||
<xsl:variable name="substitution" select="substitutions/substitution" />
|
||||
<xsl:analyze-string
|
||||
<xsl:variable name="substitution" select="substitutions/substitution" />
|
||||
<xsl:analyze-string
|
||||
select="$data" regex=".">
|
||||
<xsl:matching-substring>
|
||||
<xsl:value-of select="$substitution[@member = current()]" />
|
||||
|
@ -60,14 +60,14 @@
|
|||
<!-- Interprète la séquence -->
|
||||
<xsl:template name="Interpretation">
|
||||
<xsl:param name="data" />
|
||||
<xsl:variable name="interpretation"
|
||||
<xsl:variable name="interpretation"
|
||||
select="interpretations/interpretation" />
|
||||
<xsl:analyze-string
|
||||
<xsl:analyze-string
|
||||
select="$data" regex=".">
|
||||
<xsl:matching-substring>
|
||||
<xsl:variable name="action"
|
||||
select="$interpretation[@member = current()]" />
|
||||
<xsl:choose>
|
||||
<xsl:choose>
|
||||
<!-- Ecrire -->
|
||||
<!-- TODO: Si plusieurs <line /> se suivent on pourrait les additionner -->
|
||||
<xsl:when test="matches($action, '^LINE \d+$')">
|
||||
|
@ -104,10 +104,10 @@
|
|||
|
||||
<!-- Debug -->
|
||||
<!-- <xsl:otherwise>
|
||||
<action>
|
||||
<xsl:value-of select="$interpretation[@member = current()]" />
|
||||
</action>
|
||||
</xsl:otherwise> -->
|
||||
<action>
|
||||
<xsl:value-of select="$interpretation[@member = current()]" />
|
||||
</action>
|
||||
</xsl:otherwise> -->
|
||||
</xsl:choose>
|
||||
</xsl:matching-substring>
|
||||
</xsl:analyze-string>
|
||||
|
@ -117,8 +117,7 @@
|
|||
<!-- On récupère le Lsystem qui nous intéresse -->
|
||||
<xsl:template match="/">
|
||||
<xsl:processing-instruction name="xml-model">href="tortue.xsd"</xsl:processing-instruction>
|
||||
<xsl:apply-templates
|
||||
<xsl:apply-templates
|
||||
select="lsystems/lsystem[name=$nom]" />
|
||||
</xsl:template>
|
||||
|
||||
</xsl:transform>
|
||||
|
|
Reference in a new issue