Jump to content

pass the xsl variable to javascript parameter.


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 post
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 post
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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...