IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JavaScript Discussion :

[XSL/JavaScript]problème d'intégration code JS dans le XSL


Sujet :

JavaScript

  1. #1
    Membre régulier
    Inscrit en
    Février 2005
    Messages
    147
    Détails du profil
    Informations forums :
    Inscription : Février 2005
    Messages : 147
    Points : 78
    Points
    78
    Par défaut [XSL/JavaScript]problème d'intégration code JS dans le XSL
    Bonjour à tous et a tous, voici mon problème, j'aimerai placer mon code JS 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
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
     
    <script language="JavaScript">
     
    var button_down = null; //pour définir une valeur par défaut de bouton enfoncé
     
    function findCells(table) {  //fct qui recherche les cellules.
    	                       var tbody = table.firstChild;
    	                           while (tbody.nodeName != "TBODY") tbody = tbody.nextSibling;
    	                       var tr = tbody.firstChild;
    	                           while (tr.nodeName != "TR") tr = tr.nextSibling;
    	                       var td_left = tr.firstChild;
    	                           while (td_left.nodeName != "TD") td_left = td_left.nextSibling;
    	                       var td_center = td_left.nextSibling;
    	                           while (td_center.nodeName != "TD") td_center = td_center.nextSibling;
    	                       var td_right = td_center.nextSibling;
    	                           while (td_right.nodeName != "TD") td_right = td_right.nextSibling;
    	                       var found = new Array(td_left, td_center, td_right);
    	                           return found;
                               }
    function buttonOver(table) {
    	                         if (button_down == table.id) return true; //Va détécter si un bouton est survolé !
    							 var tds = findCells(table);
    	                         tds[0].className = "bttn_left_on";
    	                         tds[1].className = "bttn_center_on";
    	                         tds[2].className = "bttn_right_on";
                               }
    function buttonOut(table) {
    	                         if (button_down == table.id) return true;//Va détécter si un bouton est relaché !
    							 var tds = findCells(table);
    	                         tds[0].className = "bttn_left_out";
    	                         tds[1].className = "bttn_center_out";
    	                         tds[2].className = "bttn_right_out";
                              }
    function buttonUp(table) {
    	                         if (button_down == table.id) return true;//Va détécter si un bouton n'est pas enfoncé !
    							 var tds = findCells(table);
    	                         tds[0].className = "bttn_left_up";
    	                         tds[1].className = "bttn_center_up";
    	                         tds[2].className = "bttn_right_up";
                               }
    function buttonDown(table) {
                                 if (button_down == table.id) return true;//Va détécter si un bouton est enfoncé !
    	                         var tds = findCells(table);
    	                         tds[0].className = "bttn_left_down";
    	                         tds[1].className = "bttn_center_down";
    	                         tds[2].className = "bttn_right_down";
                               }
    function buttonClick(table) {
                                  if (null != button_down)  //On va chercher ici si un bouton est enfoncé ou non, si oui on change l'image!
    							     {
    		                            if (document.getElementById) 
    									   {
    		                                  var table_down = document.getElementById(button_down)
    	                                   } else if (document.all && !document.getElementById) 
    									             {
    		                                           eval("var table_down = document.all."+button_down+";");
    	                                             }
    									 if (table_down) buttonOut(table_down);							 
                                     }
    							  button_down = table.id;
    							  if (table_down) buttonOut(table_down);							  
                                }
     
        <!--   //Fonction qui lance les 2 frames
            function TwoFrames(URL1,Fr1Name,URL2,Fr2Name) 
    		         {
                      parent.frames[Fr1Name].location.href=URL1;
                      parent.frames[Fr2Name].location.href=URL2;
                     }
        //-->
     
     
    </script>
    mais cela ne focntionne pas. Et voilà ce que XML Spy me retourne :
    This file is not well formed. Name letter(Letter(|'_'| ':')) Name-Character * expected. Est ce que cela veut dire que je dois remplacer dans tout mon code les _???
    Et je voudrais savoir si je peux placer simplement mon script à cette endroit de mon code XSL??
    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
     
    <?xml version="1.0" encoding="UTF-8"?>
    <?xml:stylesheet  type="text/css" href="Style.css"?>
    <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="modules">             
         <html> 
              <head> 
                        <title>XSL Example</title>
              <script language="JavaScript">
               ...
              </script>
              </head>            
              <body bgcolor="#ABACD5" >
     
                </body> 
     </html>
    </xsl:template>
    </xsl:stylesheet>
    Je voudrais également savoir comment changer la couleur du background, car quand je fais un bgcolor dans le body, le fond reste blanc !

    J'espère avoir posté sa dans la bonne section, car la section XML/XSl semble être pour le tool indiqué et pas vraiment pour les questions relatives au XML/XSl.

    Merci à tous de votre aide,

  2. #2
    Membre régulier
    Inscrit en
    Février 2005
    Messages
    147
    Détails du profil
    Informations forums :
    Inscription : Février 2005
    Messages : 147
    Points : 78
    Points
    78
    Par défaut
    Pour le problème de JavaScript j'ai trouvé mon erreur, il fallait rajouter ceci <![CDATA[ ... code ...]]>entre les balises <SCRIPT> et </SCRIPT>
    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
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
     
    <?xml version="1.0" encoding="UTF-8"?>
    <?xml:stylesheet  type="text/css" href="Style.css"?>
    <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="modules">             
         <html> 
              <head> 
              <title>XSL TEST</title> 
              <script language="JavaScript">
              <![CDATA[
               ..... (Voir au dessus)
                ]]>
              </script>
              </head>            
              <body style="background-color:#ABACD5;">
                      <h1><u><center>Your Modules :</center></u></h1>
    				<xsl:apply-templates select="header/col"/>
    				<center>
    					<table border="1" bgcolor="lime">
    						<thead align="center">
    						         <tr>
    						         <td><strong>
                                                     <xsl:value-of select="header/col[1]/@name"/> 
    							  </strong></td>
    						         <td><strong>
                                                     <xsl:value-of select="header/col[2]/@name"/> 
    							  </strong></td>
    							  </tr>
    							  <tr>
    						         <td><strong>
                                                     <xsl:value-of select="row/col[1]"/> 
    							  </strong></td>	
    						         <td><strong>
                                                     <xsl:value-of select="row/col[2]"/> 
    							  </strong></td>	
    							  </tr>
    							  <table class="bttn" width="780" cellpadding="0" cellspacing="0">
    							       <tr>
    	     								<td>
                 									<table  ID="reporting" class="bttn" cellpadding="0" cellspacing="0" onMouseOver="buttonOver(this);" onMouseOut="buttonOut(this);" onMouseDown="buttonDown(this);" onMouseUp="buttonUp(this);" onClick="buttonClick(this);">
                    									<tr>
                       										<td class="bttn_left_out"><table class="bttn" cellspacing="0" width="12"><tr><td></td></tr>													</table></td>
                       										<td class="bttn_center_out">
                       								<A HREF="javascript:TwoFrames('../fct1024/fctreport.html','fct','../main/reporting/Report.html','main');"> 										Reporting</A></td>
                       										<td class="bttn_right_out"><table class="bttn" cellspacing="0" width="12"><tr><td></td></tr>													</table></td>
                    									</tr>
                 									</table>
    									 </td>
    		 						</tr>
    		 					 </table>					  
    						</thead>
         							<xsl:for-each select="header/col"> 
              							<xsl:value-of select="@name"/>  
    						          		<xsl:if test="not (position()=last())"> 
                   								<xsl:text>blablabla</xsl:text> 
              						  		</xsl:if>
              					    </xsl:for-each>		
    						<!-- <xsl:apply-templates select="row/col[2]"/> -->
    					</table>
    		 	   }
    				</center>
                </body> 
     </html>
    </xsl:template>
    </xsl:stylesheet>
    Mais par contre, maintenant que j'appel mes fonctions JS (onClick(),...)dans mon code XSL sa ne fonctionne pas, rien ne s'affiche, meme pas les images ! Je ne sais pas pourquoi, je ne comprends pas d'ou vient cette erreur !
    De plus je voudrais savoir si la ligne suivante est bonne pour importer mon CSS :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <?xml:stylesheet  type="text/css" href="Style.css"?>
    Merci à tous pour votre aide, pour ma part je continue a chercher de mlon coté.

  3. #3
    Membre émérite
    Inscrit en
    Septembre 2002
    Messages
    2 307
    Détails du profil
    Informations forums :
    Inscription : Septembre 2002
    Messages : 2 307
    Points : 2 814
    Points
    2 814
    Par défaut
    <link rel="stylesheet" type="text/css" href="Style.css" />
    clic sur l'icone et regarde la propriété de ton image et vérifie si l'url est bon.

  4. #4
    Membre régulier
    Inscrit en
    Février 2005
    Messages
    147
    Détails du profil
    Informations forums :
    Inscription : Février 2005
    Messages : 147
    Points : 78
    Points
    78
    Par défaut
    L'url est bien bon car mes fichiers HTML qui se trouvent dans le même repertoir que mes fichiers XML et XSL utilisent le même path.

    Par contre ce que je me demande c'est est ce que je peux placer ce code :
    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
     
    <table class="bttn" width="780" cellpadding="0" cellspacing="0">
    <tr>
        <td>
            <table  ID="reporting" class="bttn" cellpadding="0" cellspacing="0" onMouseOver="buttonOver(this);" onMouseOut="buttonOut(this);" onMouseDown="buttonDown(this);" onMouseUp="buttonUp(this);" onClick="buttonClick(this);">
                <tr>
                      <td class="bttn_left_out"><table class="bttn" cellspacing="0" width="12"><tr><td></td></tr>
     
               </table></td>
     
              <td class="bttn_center_out">
              <A HREF="javascript:TwoFrames('../fct1024/fctreport.html','fct','../main/reporting/Report.html','main');">
                   Reporting
              </A></td>
     
              <td class="bttn_right_out"><table class="bttn" cellspacing="0" width="12"><tr><td></td></tr>		
              </table></td>
     
            </tr>
    </table>
    </td>
    </tr>
    </table>
    est ce que je peux le mettre tel quel dans le <body> de mon fichier XSL?? Ou est ce que je dois modifier les liens, les appels aux fonctions javascript, les appel au class de mon CSS??? Je suis un peu perdu là, je débute là dedans et je ne trouve pas de solution à mon problème, même dans les différents tutos et faq que j'ai fait.

  5. #5
    Membre émérite
    Inscrit en
    Septembre 2002
    Messages
    2 307
    Détails du profil
    Informations forums :
    Inscription : Septembre 2002
    Messages : 2 307
    Points : 2 814
    Points
    2 814
    Par défaut
    ->
    voir le forum xml

    sinon
    <td class="bttn_left_out"><table class="bttn" cellspacing="0" width="12"><tr><td></td></tr>

    </table></td>
    il manque la balise <table>

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Problème d'intégration de php dans une page html
    Par piwyangel dans le forum Langage
    Réponses: 4
    Dernier message: 16/09/2011, 14h31
  2. Problème d'intégration de phpPgAdmin dans EasyPHP
    Par Ruben_Blanco dans le forum PostgreSQL
    Réponses: 2
    Dernier message: 20/10/2009, 13h11
  3. Problème d'intégration de PDF dans mon document LaTex
    Par joel88 dans le forum Tableaux - Graphiques - Images - Flottants
    Réponses: 6
    Dernier message: 17/04/2009, 10h41
  4. [Perl][XSL][Javascript] problème de chemin
    Par gojira dans le forum Web
    Réponses: 1
    Dernier message: 19/06/2006, 16h32

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo