xsl utilisation de variable
Bonsoir
Voilà j'ai un fichier xml résumé comme suit:
Code:
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
|
<Instances>
<Instance>
<author>
<name>nom4</name>
<article>VRP</article>
</author>
<Nodes/>
<Arcs/>
<VehicleTypes/>
</Instance>
<Instance>
<author>
<name>nom1</name>
<article>VRPP</article>
</author>
<Nodes/>
<Arcs/>
<VehicleTypes/>
</Instance>
<Instance>
<author>
<name>nom4</name>
<article>VRPTW</article>
</author>
<Nodes/>
<Arcs/>
<VehicleTypes/>
</Instance>
</Instances> |
J'ai également le fichier xsl suivant:
Code:
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
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Time-stamp: "year-list.xsl 28 sep 2010 11:09:05" -->
<!-- Feuille de style créant des listes des livres pour chaque année -->
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml">
<xsl:template match="Instances">
<html>
<head/>
<body>
<form method="post" action="wqazs.php" enctype="multipart/form-data">
<p>
<select name="choixNom">
<xsl:for-each-group select="Instance" group-by="author">
<xsl:variable name="name_author" select="author/name"/>
<option value="$name_author">
<xsl:value-of select="author/name"/>
</option>
</xsl:for-each-group>
</select>
<input type="submit" name="submit" value="ok " />
</p>
</form>
</body>
</html>
</xsl:template>
</xsl:stylesheet> |
et voici la page html générée :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
<?xml version="1.0" encoding="UTF-8"?><html xmlns="http://www.w3.org/1999/xhtml"> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Bibliographie par année</title>
</head>
<body>
<form method="post" action="wqazs.php" enctype="multipart/form-data">
<p>
<select name="choixNom">
<option value="$name_author">nom4</option>
<option value="$name_author">nom1</option>
</select>
<input type="submit" name="submit" value="ok " />
</p>
</form>
</body>
</html> |
Mon problème est le suivant :comme vous pouvez le voir sur le fichier html, l'attribut value de la balise option à la même valeur pour nom1 et nom4, or je voudrai que value contienne soit nom1, soit nom4. Je pense que le problème vient du xsl avec la variable name_author, mais je ne vois pas quoi modifier.
est-ce quelqu'un pourrai m'aider svp?
merci