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 confirm�
    Inscrit en
    F�vrier 2005
    Messages
    147
    D�tails du profil
    Informations forums :
    Inscription : F�vrier 2005
    Messages : 147
    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 confirm�
    Inscrit en
    F�vrier 2005
    Messages
    147
    D�tails du profil
    Informations forums :
    Inscription : F�vrier 2005
    Messages : 147
    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 Expert
    Inscrit en
    Septembre 2002
    Messages
    2 307
    D�tails du profil
    Informations forums :
    Inscription : Septembre 2002
    Messages : 2 307
    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 confirm�
    Inscrit en
    F�vrier 2005
    Messages
    147
    D�tails du profil
    Informations forums :
    Inscription : F�vrier 2005
    Messages : 147
    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 Expert
    Inscrit en
    Septembre 2002
    Messages
    2 307
    D�tails du profil
    Informations forums :
    Inscription : Septembre 2002
    Messages : 2 307
    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