XML execution fonction javascript

Résolu/Fermé
moi - 13 juil. 2009 à 09:39
 moi - 13 juil. 2009 à 09:44
Bonjour,
j'ai un fichier XML qui est associé à un xsl, ce xsl met en forme des données du XML est affiche un formulaire, au clique du bouton je fais certaine action de test, notament le chargement et la sauvegrade du fichier xml, le probléme et qu'un message d'érreur s'affiche au niveau de firefox et je ne sais pas d'ou cela peux venir, il est ecrit: " XMLD is not defined":

voici mon xsl:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:key name="id" match="Categorie" use="."/>

<xsl:template match="/">

    <html>
         <head>
	            <title>Liste produit disponible</title>
	            
	                <script language="JavaScript">
		    	      
		    	      <![CDATA[function Insertion()
		    	      {
		    	      		    	      
		    	      XMLD.load("D:\Documents and Settings\cDucarouge\Mes documents\Etude technique Extranet\ETL\Web Service\Proto Dom_JS\fichier_xml2.xml");
		    	      
		    	      alert('Ici, c\'est votre message!\nSympa non ?');
		    	      
		   	      XMLD.save("D:\Documents and Settings\cDucarouge\Mes documents\Etude technique Extranet\ETL\Web Service\Proto Dom_JS\fichier_xml2.xml");
		    	      }
		    	      ]]>
		    
			</script>
	           
        </head>
        <body>
            
            
             <h1> Question 2 </h1>

           	 <xsl:apply-templates select="//Liste_des_Produits"/>
        </body>
	
	
    </html>
</xsl:template>


<xsl:template match="//Liste_des_Produits">
	<xsl:param name="choix"> 1 </xsl:param>

	<xsl:choose>
    <xsl:when test="$choix=1">
            <table>
            <caption> Liste produit - 2 </caption>
            <tr><th>Nom Produit</th> <th> R&#233;f&#233;rence</th> <th> Cat&#233;gorie </th></tr>
        
            	<xsl:for-each select="/Liste_des_Produits/Produit">
                <xsl:sort select="Nom_Produit"/>
                
                
                <tr> 
                <td class="nom"> <xsl:value-of select = "Nom_Produit"/> </td>
                <td class="niv"><xsl:value-of select ="Reference"/></td>
                <td class="emp"><xsl:value-of select ="Categorie"/> </td>
                </tr>
            
            </xsl:for-each>
               
             </table>
             
             
             <form method="post">

	     
	     			<TR>
	     				<TD>Nom Produit</TD>
	     				<TD>
	     					<INPUT type="text" name="Nom_Produit"/>
	     				</TD>
	     			</TR>
	     
	     			<TR>
	     				<TD>Reference</TD>
	     				<TD>
	     					<INPUT type="text" name="Reference"/>
	     				</TD>
	     			</TR>

	     			<TR>
	     				<TD>Categrorie</TD>
	     				<TD>
	     					<SELECT>
	     						
 							<xsl:for-each select="//Categorie[generate-id(.)=generate-id(key('id', .) [1])]">
	     							<OPTION><xsl:value-of select ="."/> </OPTION>		     						
	     						</xsl:for-each>	     
	     					</SELECT>
	     
	     				</TD>
	     			</TR>
	     
	     			<TR>
	     				<TD>
	     					<INPUT type="submit" value="Ajouter" onclick="Insertion()"/>
	     				</TD>
	     			</TR>

	     
	     </form>

             
    </xsl:when>
    <xsl:otherwise>
    <table>
    <caption> Liste produit - 1 </caption>
    <tr><th>Nom Produit</th> <th> Niveau danger</th> <th> Emplacement </th></tr>
    
    <xsl:for-each select="/Liste_des_Produits/Produit">
        <xsl:sort select="Niveau_Danger"/>
        <tr> 
        <td class="nom"> <xsl:value-of select = "Nom_Produit"/> </td>
        <td class="niv"><xsl:value-of select ="Niveau_Danger"/></td>
        <td class="emp"><xsl:value-of select ="Stockage/Emplacement"/> </td>
        </tr>
    </xsl:for-each>
    
    </table>

    </xsl:otherwise>
    </xsl:choose> 
       
      
</xsl:template>


</xsl:stylesheet>
A voir également:

1 réponse

oups j'ai trouvé mon erreur je n'ai pas déclaré ma variable xmld
0