[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: xsl variable not resolved in javascript output

Subject: RE: xsl variable not resolved in javascript output
From: Maria Amuchastegui <mamuchastegui@xxxxxxxxxxx>
Date: Thu, 12 May 2005 11:46:09 -0400
javascript output
You're calling an XSL variable from inside a CDATA declaration, which is not
going to work. You can try removing the CDATA declaration, which is not
always needed for Javascript, or at least placing the variable outside it.

Maria

-----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 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.