OLO: XSL und Javascript

Beitrag lesen

Hi,

ich hoffe einer von euch kann mir helfen.
Ich hab eine xslt auf der ich ein paar Quadrate ausgeben möchte. Wenn man mittels mouseover über eines der Texte fährt soll ein individueller Tooltip angezeigt werden. Der Tooltip soll mittels Javascript noch etwas aufgepeppt werden. Dafür erzeuge ich mir vorher ein <div> und möchte diese dann einblenden/ausblenden über den einzelnen Quadraten. So der Plan.

Ich erzeuge mittels xsl:foreach meine Divs und  danach die Quadrate.
Wenn ich dann alledings per JavaScript versuche auf die Divs zuzugreifen. Sind diese "Null".

Ist mir echt nich klar warum?!

Ich hoffe mir kann jemand helfen.

Hier mein Code. Danke im Vorraus!

  
<?xml version="1.0" encoding="UTF-8" ?>  
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">  
  
  <xsl:template match="/">  
    <html xmlns="http://www.w3.org/1999/xhtml" >  
      <head>  
        <title></title>  
        <style type="text/css">  
          .tooltip  
          {  
          visibility: hidden;  
          position: absolute;  
          top: 0;  
          left: 0;  
          z-index: 2;  
  
          font: normal 8pt sans-serif;  
          padding: 3px;  
          border: solid 1px;  
          }  
          .Cell{padding:0px; margin:0px; padding-top:0px; border-width:0px;}  
        </style>  
      </head>  
      <body>  
<!-- Hier erzeug ich die Divs -->  
           <xsl:for-each select="Quadrate">  
            <xsl:sort select="y" data-type="number" order="ascending"/>  
               <xsl:call-template name="SetDiv"></xsl:call-template>  
           </xsl:for-each>  
  
        [code lang=javascript]  
       <script type="text/javascript" language="javascript">  
  
          function testXY(x){  
          //  alert(x);  
          //   alert(document.getElementById(x));  
          }  
  
          function document.onmouseover()  
          {  
          var eSrc = window.event.srcElement;  
           var x = -1;  
          if(eSrc.className.search("divtooltip")==x){  
          }else{  
          alert(eSrc.className);  
          TagToTip(eSrc.className);  
         alert( document.getElementById(eSrc.className));  
          }  
  
          }  
        </script>  

<table>
     <xsl:for-each select="Quadrate">
 <xsl:sort select="y" data-type="number" order="ascending"/>
            <tr id="x">
              <xsl:attribute name="id">
                <xsl:value-of select="value"/>
              </xsl:attribute>
             <td bgcolor="red" width="5px" height="5px">
               <xsl:call-template name="SetText"></xsl:call-template>
              </td>
            </tr>
          </xsl:for-each>
        </table>
      </body>
    </html>
  </xsl:template>

<xsl:template name="SetText">
    <table  border="1" rules="all" Height="100%" width="100%" >
      <xsl:attribute name="onmouseover" >
         testXY('divtooltip_<xsl:value-of select="y"/><xsl:value-of select="../Value"/>');
      </xsl:attribute>
      <xsl:attribute name="class" >
    divtooltip_<xsl:value-of select="y"/><xsl:value-of select="../Value"/>
      </xsl:attribute>
      <tr width="100">
        <td>
        </td>
      </tr>
    </table>

</xsl:template>
  <xsl:template name="SetDiv">
    <div id=""  style=""  class="tooltip">
      <xsl:attribute name="id">
          divtooltip_<xsl:value-of select="y"/><xsl:value-of select="../Value"/>
       </xsl:attribute>
      <xsl:attribute name="style">
        visibility:hidden
      </xsl:attribute>
      <table style="background-color:Red" >
        <tr>
          <td>
            <table>
              <tr>
                <td>
                  ID:divtooltip_<xsl:value-of select="y"/><xsl:value-of select="../Value"/>
                  Name:    <xsl:value-of select="Beschreibung"/>
                </td>
              </tr>
              <tr>
                <td>
                  Beschreibung: <xsl:value-of select="Beschreibung"/>
                </td>
              </tr>
              <tr>
                <td>
                  <a href="Default.aspx">
                    Link:  <xsl:value-of select="Beschreibung"/>
                  </a>
                </td>
              </tr>
            </table>
          </td>
          <td>
            Hier <br /> Bild
          </td>
        </tr>
      </table>
    </div>
  </xsl:template>
</xsl:stylesheet>
[/code]