RE: [xsl] dynamically generating JavaScript using XSLT

Subject: RE: [xsl] dynamically generating JavaScript using XSLT
From: "Chris Bayes" <chris@xxxxxxxxxxx>
Date: Fri, 31 Aug 2001 21:04:58 +0100
Why not do
document.writeln('<a href="javascript:{@ID}()" target="_self"
onMouseover="status=null;return true;" onMouseout="status=null;return
true;"><xsl:apply-templates /></a>');

Ciao Chris

XML/XSL Portal
http://www.bayes.co.uk/xml


> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Sebastian Schirmer
> Sent: 31 August 2001 20:27
> To: Xsl-List (E-Mail)
> Subject: [xsl] dynamically generating JavaScript using XSLT
> 
> 
> 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
> 
> 


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


Current Thread