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

dynamically generating JavaScript using XSLT

Subject: dynamically generating JavaScript using XSLT
From: Sebastian Schirmer <schirmer@xxxxxxxxxxxxx>
Date: Fri, 31 Aug 2001 21:27:13 +0200
xsl noscript
Hello!

I want to dynamically generate JavaScript Code using a XSL Transformation,
but I dont know if it is possible at all:

The XSLT Code should look like the following snippet: (Pseudocode)


<xsl:template match="link[@targetcomponent = 'image']" priority="2">
	<script language="JavaScript">
		function <xsl:value-of select="@ID"/>()
		{
			var popWin =
window.open('go/imagedetailview?ID=<xsl:value-of
select="@ID"/>&amp;DV=<xsl:value-of
select="@derivative"/>&amp;COMP=<xsl:value-of
select="@targetcomponent"/><xsl:value-of
select="$sessionId"/>','Imagedetailview','width=400,height=400,locationbar=n
o,menuebar=no,status=no,scrollbars=1,resizable=1');
		}
							
		document.writeln("<xsl:text
disable-output-escaping="yes">&lt;</xsl:text>a
href=\"javascript:<xsl:value-of select="@ID"/>()\" target=\"_self\"
onMouseover=\"status=\'\';return true;\" onMouseout=\"status=\'\';return
true;\"<xsl:text disable-output-escaping="yes">&gt;</xsl:text>");
		<xsl:apply-templates /> <!-- Image goes here -->

		<xsl:text
disable-output-escaping="yes">&lt;/a&gt;</xsl:text>
	</script>
</xsl:template>


The Problem is that I have to write the link using document.write() because
there will be a <noscript> part that will be displayed if a user has JS
disabled.

The output method has to be XML and cant be HTML. The output is written into
a JDOMResult, not into a StreamResult, so this makes the whole thing even
more complicated. I dont know how to solve this problem, maybe work with
CDATA sections, ... 


If anybody knows how to solve this, please let me know.


Sebastian Schirmer

<<<<<<<<<<<<<<<<<<<<<<<<<<<
sitewaerts GmbH
Hebelstraße 15
D-76133 Karlsruhe

Tel: +49 (721) 920 918 0
Fax: +49 (721) 920 918 29
http://www.sitewaerts.de
>>>>>>>>>>>>>>>>>>>>>>>>>>>



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.