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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + Use of before and after string (3) Sticky Topic
-> - How do I substitute element ty... (1)
-> + How does one add working days ... (4)
-> - Help, I have existing XLT and... (1)
-> + Need help on XSLT issue - (2)
-> + EDI to XML Conversion (7)
-> - XML To JSON Conversion using X... (1)
-> + Formatting Paragraphs to same ... (2)
-> - Grouping of records (1)
-> + Problems with xsd 1.1 (4)
-> + XML to HL7 mapping (3)
-> + XSLT 3 and Iterate (2)
-> + XSL-FO to PDF preview (3)
-> + java.lang.RuntimeException: Er... (2)
-> + Create Acroforms with Stylus X... (2)
-> + How to change XSLT parameter s... (3)
-> + how to change format of the da... (2)
-> + Search "Next 8 Results " doesn... (2)
-> - Support for Git (1)
-> + newbee (8)
-- [1-20] [21-40] [41-60] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
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

   
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.