xsl-list
[Top] [All Lists]

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

2007-09-03 21:15:47
I have a lot of experience with this sort of thing and it sounds like
a Javascript problem. There are times when XSL will render Javascript
funny, but 99% of the time my Javascript is used much like yours and
I've never had a problem.

You could try using alert('message') to make certain that the
Javascript is triggering as expected, and probably lots of other
things, but unfortunately all that is out of the scope of this list.
=) Keep at it, sounds like you're almost there.

-Steve

On 9/4/07, Alice Ju-Hsuan Wei <ajwei(_at_)indiana(_dot_)edu> wrote:
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(_at_)gmail(_dot_)com>:

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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--