Bonjour à tous;
Je réalise actuellement une application ASP.Net qui génère des fihciers VoiceXml. A partir d'un fichier XML, je génère un fichier VoiceXml.
Voici mon fichier XML :
Voici mon fichier xsl (pas encore complet pour l'instant!) :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 <?xml version="1.0" encoding="utf-8" standalone="no" ?> <itinéraire handicap="1" date="13/05/2004 14:31:52" PointDepart="Gare" PointArrivee="Aéroport"> <Segment id="3"> <Point_Depart id="2" etage="1"> <Description_Depart>Gare</Description_Depart> </Point_Depart> <Point_Arrivee id="3" etage="1"> <Description_Arrivee>Aéroport</Description_Arrivee> </Point_Arrivee> <Description>Segment3</Description> </Segment> </itinéraire>
Et voici le résultat obtenu :
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
36
37
38
39
40
41
42
43
44
45
46 <?xml version="1.0" encoding="ISO-8859-1" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="itinéraire"> <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml"> <form id="etape0"> <block> <prompt> l'ITINERAIRE demandé va de <xsl:value-of select="@PointDepart" /> a <xsl:value-of select="@PointArrivee" /> </prompt> <goto next="#etape1" /> </block> </form> <xsl:apply-templates /> <form id="fin"> <block> <prompt bargein="false">Fin du trajet</prompt> </block> </form> </vxml> </xsl:template> <xsl:template match="Segment"> <xsl:variable name="numetape" select="position()" /> <xsl:variable name="etapeSuiv" select="position()+1" /> <form id="etape{$numetape}"> <block> <prompt> étape n° <xsl:value-of select="$numetape" /> <xsl:value-of select="Description" /> </prompt> <noinput> <xsl:if test="position()=last()"> <goto next="#fin" /> </xsl:if> <xsl:if test="not(position()=last())"> <goto next="#etape{$etapeSuiv}" /> </xsl:if> </noinput> </block> </form> </xsl:template> </xsl:stylesheet>
Mon problème intervient au niveau des form ayant un id égal à etape.... En effet, je ne comprends pas pourquoi la transformation xsl m'ajoute un attribut xmlns égal à une chaîne vide car le problème c'est que la balise form se supporte pas a priori d'attribut xmlns donc je suis bien embêtée ...
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 <?xml version="1.0" encoding="utf-8" ?> <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml"> <form id="etape0"> <block> <prompt>l'ITINERAIRE demandé va de Gare a Aéroport</prompt> <goto next="#etape1" /> </block> </form> <form id="etape1" xmlns=""> <block> <prompt>étape n° 1Segment3</prompt> <noinput> <goto next="#fin" /> </noinput> </block> </form> <form id="fin"> <block> <prompt bargein="false">Fin du trajet</prompt> </block> </form> </vxml>
Si quelqu'un a la moindre petite idée, elle est la bienvenue !
Partager