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
Rinni VermaSubject: Error calling javascript from xsl
Author: Rinni Verma
Date: 12 Jul 2005 11:05 AM
Hello All,

I am trying to call a javascript function from xsl file but I am getting the following error:

"Runtime jscript error: object required"

My code is as follows:

<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:showhide="urn:my-scripts">

<msxsl:script language="javascript" implements-prefix="showhide">
<![CDATA[
function list_onclick_(list, image, state){
var imageOpen = "images/shared/cMenuPlusSign.gif";
var imageClose = "images/shared/cMenuMinusSign.gif";
listClicked(list);

if (state == "expanded") {
if (image.toggle)
image.src = imageOpen;
else
image.src = imageClose
}
else {
if (image.toggle)
image.src = imageClose
else
image.src = imageOpen;
}

image.toggle = !image.toggle;

}

function listClicked(list){
var state = eval(list + ".style.display");

if (state != "none"){
eval(list + ".style.display ='none'");
}
else {
eval(list + ".style.display ='block'");
}
}
]]>
</msxsl:script>

<xsl:output method="html" indent="no" media-type="text" omit-xml-declaration="yes" />

<xsl:template match="/">

<br></br>
<input type="button" value="Expand All" id="button1"></input>
<input type="button" value="Contract All" id="button2"></input>
<br></br>
<br></br>
<table ID="Table0">
<tr>
<TD>

<xsl:attribute name="colspan">2</xsl:attribute><xsl:attribute name="style">CURSOR: pointer</xsl:attribute><xsl:attribute name="onclick_">showhide:list_onclick_('id1', image1, 'expanded')</xsl:attribute><xsl:element name="img"><xsl:attribute name="name">image1</xsl:attribute><xsl:attribute name="BORDER">0</xsl:attribute><xsl:attribute name="src">images/shared/cMenuPlusSign.gif</xsl:attribute></xsl:element><font class="TableFontSize2"><strong>Borrower Details</strong></font>

</TD>
</tr>
</table>
<xsl:text disable-output-escaping="yes">&#160;</xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

Thanks,
Rinni

Postnext
Ivan PedruzziSubject: Error calling javascript from xsl
Author: Ivan Pedruzzi
Date: 12 Jul 2005 07:12 PM

Rinni

- The XSLT posted is incomplete.
An xsl:if start tag is missing.

- The XSLT code is not invoking any script function
See this thread
http://www.stylusstudio.com/SSDN/default.asp?action=9&read=3507&fid=48#9920

- You didn't post any XML input document so is quite
difficult understand what you are trying to do.


Ivan Pedruzzi
Stylus Studio team

Posttop
Rinni VermaSubject: Error calling javascript from xsl
Author: Rinni Verma
Date: 13 Jul 2005 09:01 AM
Hi Evan,

Thanks for your prompt response.

I have been able to fix the problem.

Infact since I was using an asp page to display the data, I moved the javascript functions to that page and things worked right.

Thanks.

Rinni

 
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.