XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Anne WrehSubject: Insert javascript calls in XSL output at client side?? is this possible? if yes how????
Author: Anne Wreh
Date: 11 Apr 2006 06:15 AM
Hi all.

I'm a bit frustrated right now :-(

I've been playing around with client-side XSL transformations with Ajax and I'm facing that problem mentioned in the topic. All the processing is made in the client-side.

What I want to do is the following:

- I'm receiving xml data from an HTTP request from a server.

- This xml data needs to be parsed with xsl and displayed in the browsers using a data grid control.

- To display the data of each row I have to make javsacript calls like: gridView.addDataRow ( "[ID]", new Array ( [DATA ] )

I have tried inserting the tag ( with and without the xsl:text ):
[CODE]
<script>
<xsl:text>gridView.addRowData("</xsl:text><xsl:value-of select="../@unid"/><xsl:text>", new Array ( "</xsl:text><xsl:apply-templates/><xsl:text>");</xsl:text>
</script>
[CODE]
inside the xsl for each element to display but I get an error,

I have tried also the following code ( with and without the xsl:text ):
[CODE]
<lxslt:script lang="javascript">
<xsl:text>gridView.addRowData("</xsl:text><xsl:value-of select="../@unid"/><xsl:text>", new Array ( "</xsl:text><xsl:apply-templates/><xsl:text>");</xsl:text>
</lxslt:script>
[CODE]

but also without any luck!! :( .

I'm now completely lost and I don't know what to do, anyone could help me a bit with that??

Thanks guys!!

PD: gridView is a JS object defined previously in the document.

Posttop
Ivan PedruzziSubject: Insert javascript calls in XSL output at client side?? is this possible? if yes how????
Author: Ivan Pedruzzi
Date: 11 Apr 2006 11:45 AM

Assuming that you transformation generates the right text for the variable $data

<xsl:variable name="unid" select="../@unid"/>
<xsl:variable name="data"><xsl:apply-templates/></xsl:variable>

<lxslt:script lang="javascript">
<xsl:value-of select="concat('gridView.addRowData(', $unid, ', new Array(', $data, '));')" />
</lxslt:script>



Ivan Pedruzzi
Stylus Studio Team

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.