Bonjour. J'ai le code XML suivant:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 
<?xml version="1.0" encoding="iso-8859-1"?>
<Sequence>
 
  <Carte>
    <type>Debut</type>
  </Carte>
 
  <Carte>
    <type>Action</type>
    <instruction>robot.walk</instruction>
    <simultané></simultané>
  </Carte>
 
  <Carte>
    <type>Valeur</type>
    <instruction>10</instruction>
  </Carte>
 
  <Carte>
    <type>Unité</type>
    <instruction>s</instruction>
  </Carte>
 
  <Carte>
    <type>Valeur</type>
    <instruction>2</instruction>
  </Carte>
 
  <Carte>
    <type>Unité</type>
    <instruction>loopn</instruction>
  </Carte>
 
</Sequence>
Mon code xslt est le suivant:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="text" indent="no"/>
  <xsl:template match="Sequence">
    <xsl:for-each select="Carte">
      <xsl:value-of select="instruction"/>
      <xsl:choose>
        <xsl:when test="type='Action'">(</xsl:when>
        <xsl:when test="type='Unité'">
          <xsl:if test="instruction!='loopn'">);</xsl:if></xsl:when>
      </xsl:choose>
    </xsl:for-each>
  </xsl:template>
 
</xsl:stylesheet>
J'obtiens donc ce résultat:

robot.walk(10s);2loopn

Est-il possible d'obtenir le résultat suivant: loopn(2){robot.walk(10s)};

en modifiant uniquement le XSLT et pas le XML?

Merci d'avance.