Re: [xsl] embedding xsl within javascript

Subject: Re: [xsl] embedding xsl within javascript
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 29 Jul 2004 15:35:31 +0100
  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>

or more simply:

 <img src="{$ImgDir}/about/about1_on.gif"/>

  but what within javascript statements? like in the mouseover state above?
  how do I add the $ImgDir
  into the image path?

XSLT knows nothing about XHTML or javascript or anything else: attribute
values are just opaque strings as far as xslt is concerned, so you just
do exactly the same in either the xsl:attribute or attribute value
template style:

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

Or, again, more simply using an AVT

<a href="about.asp?page=1"
onmouseover="MM_swapImage('a1','','{$ImgDir}/about/about1_on.gif',1)"
onmouseout="MM_swapImgRestore()"><img src="{$ImgDir}/about/about1.gif"
border="0" name="a1"/></a>

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread