[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl]Putting Mouseover Javascript Script in XSLT?


Subject: Re: [xsl]Putting Mouseover Javascript Script in XSLT?
From: Alice Ju-Hsuan Wei <ajwei@xxxxxxxxxxx>
Date: Tue, 4 Sep 2007 00:10:52 -0400

Hi, Guys:

Thanks for helping out with the tip, and now it does print out the proper node as it should be. It also shows the original preset image.

However, when I scroll over the mouse, its arrows point up but does not display the image. This is my modified code:

<xsl:template match="graphic">

<a>
<xsl:attribute name="href">#</xsl:attribute>
<xsl:attribute name="onmouseout">MM_swapImgRestore()</xsl:attribute>
<xsl:attribute name="onmouseover">MM_swapImage('Image1','','<xsl:value-of
select="./@url"/>',1)"</xsl:attribute>
<img>
<xsl:attribute name="src">BG008.jpg</xsl:attribute>
<xsl:attribute name="alt">
<xsl:value-of select="./@alt"/>
</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of select="./@id"/>
</xsl:attribute>
<xsl:attribute name="width">150</xsl:attribute>
<xsl:attribute name="height">113</xsl:attribute>
<xsl:attribute name="border">0</xsl:attribute>
<xsl:attribute name="name">Image 1</xsl:attribute>
</img>
</a>


       <xsl:call-template name="id"/>
       <xsl:call-template name="rend"/>
       <xsl:attribute name="alt">
           <xsl:choose>
               <xsl:when test="../figDesc">
                   <xsl:value-of select="../figDesc/text()"/>
               </xsl:when>

               <xsl:otherwise>
                   <xsl:value-of select="'graphic'"/>
               </xsl:otherwise>
           </xsl:choose>
       </xsl:attribute>

</xsl:template>

Does anyone know if template values do conflict with the javascript in XML?

Thanks to those who can help.

A Newbie.

Quoting Steve <subsume@xxxxxxxxx>:

Hey there,

Your xsl and javascript look more or less accurate, so in the event
its not working I'd try some things:

1) Put xsl:attributes directly after the <img> tag, assuming that is
the tag you're adding attributes to.

2) Perform some simple debug measures by echo'ing the actual value of
/@url to make sure it is as expected.

3) Make sure the Javascript actually works. If you're using Firefox,
check the 'error console' to make extra certain your problem isn't
Javascript.

-Steve


Current Thread
Keywords
xsl