|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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"/>&DV=<xsl:value-of select="@derivative"/>&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"><</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">></xsl:text>"); <xsl:apply-templates /> <!-- Image goes here --> <xsl:text disable-output-escaping="yes"></a></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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






