Re: [xsl] embedding xsl within javascript

Subject: Re: [xsl] embedding xsl within javascript
From: dave frette <gohabitat@xxxxxxxxx>
Date: Thu, 29 Jul 2004 08:05:02 -0700 (PDT)
Hi Rob - My second post!  =)

1. You could attempt to create a wrapper onmouseover/onmouseout function.  
Do not use CData around it.

example:

function mm_swapimage_wrapper(paramImgSrc) {
  myImg.src = <xsl:value-of select="$ImgDir" /> +  paramImgSrc;
  MM_swapimage('a1', '', myImage.src);
}

working example:
http://www.suodenjoki.dk/us/productions/articles/photo_gallery.htm

2. Modify you current <a> tag

<a href="about.asp?page=1">
  <xsl:attribute name="onmouseover">
    MM_swapImage('a1', '', '/
    <xsl:value-of select="$ImgDir"/>/about/about1_on.gif',1)
    about/about1_on.gif')
  </xsl:attribute>
</a>




3.  Same as #2, only cleaner.  Create an XSLT file that updates your XML, to include 
the whole onmouseover parameter for each image.  Or you could just rewirte
your XML file or your XML generation process.  Then, your <a> is even easier!

<a href="about.asp?page=1">
  <xsl:attribute name="onmouseover">
    <xsl:value-of select="mouse_over_event"/>
  </xsl:attribute>
</a>

working example of my own here:
http://www.frettefamily.com/xml/galleries.xml
(not all links work because it's still under construction so to speak.)


I hope this helps, 

- Dave



--- Rob Bradley <rob@xxxxxxxxxxxxxxxxxxxx> wrote:

> hi there, my first post here - how exciting...   ;)
> 
> within my xsl I have the following basic rollover functionality
> 
> ----
> <a href="about.asp?page=1"
> onmouseover="MM_swapImage('a1','','/images/about/about1_on.gif',1)"
> onmouseout="MM_swapImgRestore()"><img src="/images/about/about1.gif"
> border="0" name="a1"/></a>
> ----
> 
> I want to add a parameter to the image path, which is straightforward if its
> just around the <img> tag:
> 
> ----
> <xsl:attribute name="src"><xsl:value-of
> select="$ImgDir"/>about/about1_on.gif</xsl:attribute></img>
> ----
> 
> but what within javascript statements? like in the mouseover state above?
> how do I add the $ImgDir
> into the image path?
> 
> many thanks
> 
> rob
> 
>


		
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

Current Thread