Subject: RE: [xsl] xsl variable not resolved in javascript output From: "Ross, Douglas" <DRoss@xxxxxxxxxx> Date: Thu, 12 May 2005 11:47:08 -0400 |
Also you need to use an element to get the value: <![CDATA[ function showbook() { var showframeURL = ']]><xsl:value-of select="$__Frameset_File_Name_token"/><![CDATA[... Douglas Ross Developer, HTML UI Framework Kronos www.kronos.com -----Original Message----- From: Ross, Douglas [mailto:DRoss@xxxxxxxxxx] Sent: Thursday, May 12, 2005 11:44 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: [xsl] xsl variable not resolved in javascript output It looks like your variable is within a CDATA section. Perhaps, you migth try breaking up the CDATA section around the variable. <![CDATA[ function showbook() { var showframeURL = ']]>$__Frameset_File_Name_token<![CDATA[... Douglas Ross Developer, HTML UI Framework Kronos www.kronos.com -----Original Message----- From: Annmarie Rubin (anrubin) [mailto:anrubin@xxxxxxxxx] Sent: Thursday, May 12, 2005 11:40 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Cc: Annmarie Rubin (anrubin) Subject: [xsl] xsl variable not resolved in javascript output Hello list, an xsl template outputs javascript code to display frames in the resulting html. I am trying to use an xsl variable in the javascript code to refer to the url to display with frames, but can't get the correct syntax so that the xsl variable is resolved to a file name. Is there a way to do this? I'm using xalan 2.6.0. The code snippet of the xsl is shown below. This is the xsl:variable definition: <xsl:variable name="__Frameset_File_Name_token">index.htm</xsl:variable> I have tried the following syntax to specify the xsl variable in the outputted javascript but the xsl variable is not resolved: xsl code: "{$__Frameset_File_Name_token}" + "?" + document.URL; result in html: {$__Frameset_File_Name_token xsl code: "$__Frameset_File_Name_token" + "?" + document.URL; result in html: $__Frameset_File_Name_token? xsl code: $__Frameset_File_Name_token + "?" + document.URL; result in html:no show/hide links xsl code: "'$__Frameset_File_Name_token'" + "?" + document.URL; =20 result in html: null filename. the link resolved to the containing directory xsl code: '$__Frameset_File_Name_token' + "?" + document.URL; =20 result in html:$__Frameset_File_Name_token Thanks for your help, Ann Marie <!-- xsl code snippet --> <xsl:template name="ShowTOCButton"> <script language="javascript1.2" type="text/javascript"> <xsl:comment><![CDATA[ function showbook() { var showframeURL = '$__Frameset_File_Name_token' + "?" + document.URL; var hideframeURL = unescape(document.URL); if (window.self == top) { document.write("<a href='" + showframeURL + "' title='Show table of contents and index'><font face='verdana, arial, helvetica, sans serif' size='1'>Show Book</font></a>"); } else { document.write("<a href='" + hideframeURL + "' target='_top' title='Hide table of contents and index'><font face='verdana, arial, helvetica, sans serif' size='1'>Hide Book</font></a>"); } } showbook(); //]]></xsl:comment> </script> </xsl:template>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] xsl variable not resolved, Maria Amuchastegui | Thread | [xsl] Re: xsl-list Digest 7 Apr 200, Shivani Goel |
Re: [xsl] xsl variable not resolved, David Carlisle | Date | Re: [xsl] extracting data from html, David Carlisle |
Month |