Probleme avec xsl

mouna_bj Messages postés 49 Statut Membre -  
mouna_bj Messages postés 49 Statut Membre -
Bonjour,
J'ai le fichier XML suivant:
<racine>
<fichier nom="index.xml">
<title>
Authentification du titulaire
</title>
<logo_head>
"images/logo_codoc.gif"
</logo_head>
<bienvenue>
</bienvenue>
<logo_foot>
images/logo_infra.gif
</logo_foot>
<foot>
</foot>
<main>
<form >
<table id="tab1">
<ligne>
<texte>
Identifiant
</texte>
<input type="text">
yes
</input>
</ligne>
<ligne>
<texte>
Mot de passe
</texte>
<input type="password" >
</input>
</ligne>
<ligne>
<bouton type="button">

connexion

</bouton>
<link href="recup_pwd.xml">

Mot de passe oublié

</link>
</ligne>
<ligne>
<link href="inscription.xml">
Inscription
</link>
</ligne>
</table>
</form>
</main>
</fichier>
</racine>

et le fichier XSL associé doit chercher dans le fichier XML les lignes qui ont les balises <input> avec la valeur 'yes' pour insérer alors un champ de texte dans l'outpout HTML. Le fichier est le suivant:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<title>
<xsl:value-of select="racine/fichier/title"/>
</title>

<link rel="stylesheet" media="screen" type="text/css" title="Style" href="stylelogin.css" />

</head>

<body>
<table align="center">
<tr>
<td><img src="images/logo.gif"/></td>
<td id="entete" style="background-color:#cccc"> </td>
</tr>
</table >
<br/> <br/> <br/> <br/>
<form id="form">
<table align="center" class="tableLogin">
<xsl:for-each select="racine/fichier/main/form/table/ligne">
<tr>
<td><xsl:value-of select="texte"/></td>
<xsl:if test=".[input='yes']">
<td><input type="text" id= "tit_id" name="tit_id" value="" /></td>
</xsl:if>

<td> <a href=""> <xsl:value-of select="link"/> </a></td>

</tr>
</xsl:for-each>
</table>
</form>
<br/> <br/> <br/> <br/>

<table align="center">
<tr>
<td><img src="images/logo.gif"/></td>

<td bgcolor="#ccccff" width="705" height="90"></td>

</tr>

</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Le problème est qu'à l'exécution, il m'affiche l'erreur suivante:

Invalid XPath expression
Unexpected token - "[input='yes']"
test=".[input='yes']"

quelqu'un a une idée?

1 réponse

mouna_bj Messages postés 49 Statut Membre 3
 
Bon, normalement j'ai résolu le problème, mais il y a un autre truc :

Si j'ai la ligne suivante:
<td colspan="2" align="center"><input type="submit" class="button" name="login" value="" /></td>

et dans le champ value je veux insérer le nom du bouton se trouvant dans le fichier XML, qu'est ce que je dois alors écrire dans l'attribut "value"
0