Jump to content

pass the xsl variable to javascript parameter.


jle
 Share

Recommended Posts

Hi all,I would like to pass the xsl parameter to javascript's parameter.So name is defined as "comp" and I would like to pass this variable to parameter of AC_FL_RunContentBasislly I would like to use $comp instead of hard coded of compression02.xml.Your help is greatly appricated.Thanks,JPMy xsl file is define as below:<xsl:param name="comp" select="'xml/comp.xml'"/>..............................................................<h2>Percent Compression</h2><script type="text/javascript">AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0', 'width','680', 'height','190', 'id','charts2', 'align','', 'src','swf/charts?stage_width=680&stage_height=190&library_path=charts_library&xml_source=xml/compression02.xml', 'quality','high', 'bgcolor','#ffffff', 'name','charts2', 'swliveconnect','true', 'pluginspage','http://www.macromedia.com/go/getflashplayer', 'movie','swf/charts?stage_width=680&stage_height=190&stage_scale=2&library_path=charts_library&xml_source=xml/compression02.xml'); //end AC code--------

Link to comment
Share on other sites

<xsl:param name="comp" select="'xml/comp.xml'"/>..............................................................<h2>Percent Compression</h2><script type="text/javascript">AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0','width','680','height','190','id','charts2','align','','src','swf/charts?stage_width=680&stage_height=190&library_path=charts_library&xml_source=<xsl:value-of select="$comp"/>','quality','high','bgcolor','#ffffff','name','charts2','swliveconnect','true','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','swf/charts?stage_width=680&stage_height=190&stage_scale=2&library_path=charts_library&xml_source=<xsl:value-of select="$comp"/>'); //end AC code

?

Link to comment
Share on other sites

if your desire is to embed a javascript function inside your XLST, this is how you can do it (I am using the MSXSL parser, so this example is based on that)<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:user="http://www.mont.com" xmlns:msxsl="urn:schemas-microsoft-com:xslt" version="1.0"> <xsl:template match="*"> <xsl:if test="contains(.,':') and contains(.,'UHC')"> <xsl:value-of select="user:getStatusCode(string(.))"/> <!-- your param is in blue, note that you MUST convert your value to a string first --> </xsl:if> </xsl:template> <msxsl:script implements-prefix="user" language="JScript"> <![CDATA[ function getStatusCode(value) { var re = /^UHC.+?:\W?((.{2}:.{2}:?)+)/; re.exec(value); return RegExp.$1; } ]]> </msxsl:script></xsl:stylesheet>Note that this is my code, I did not attempt to make sense out of yours. There should be enough here for you to see the process

Link to comment
Share on other sites

<xsl:param name="comp" select="'xml/comp.xml'"/>..............................................................<h2>Percent Compression</h2><script type="text/javascript">AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0','width','680','height','190','id','charts2','align','','src','swf/charts?stage_width=680&stage_height=190&library_path=charts_library&xml_source=<xsl:value-of select="$comp"/>','quality','high','bgcolor','#ffffff','name','charts2','swliveconnect','true','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','swf/charts?stage_width=680&stage_height=190&stage_scale=2&library_path=charts_library&xml_source=<xsl:value-of select="$comp"/>'); //end AC code

?

Thank you so very much for the help.It worked.Thanks,JP
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...