[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: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 12 May 2005 16:55:36 +0100
javascript output
The curly brace syntax is only available in attributes. In element content,
use <xsl:value-of select="$var"/>.

Michael Kay
http://www.saxonica.com/

 

> -----Original Message-----
> From: Annmarie Rubin (anrubin) [mailto:anrubin@xxxxxxxxx] 
> Sent: 12 May 2005 16:40
> 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.