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
Maggie KhooSubject: xalan:component
Author: Maggie Khoo
Date: 21 Feb 2007 07:18 PM
I am using the example provided in xalan.apache.org website but I am getting an error.
java.lang.NullPointerException

I added bsf.jar, bsfengines.jar and js.jar into my classpath. Is there any conflict between the versions?

Any suggestions?

<?xml version="1.0"?>
<!--Namespaces are global if you set them in the stylesheet element-->
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:lxslt="http://xml.apache.org/xslt"
xmlns:my-ext="ext1"
extension-element-prefixes="my-ext">

<!--The component and its script are in the lxslt namespace and define the
implementation of the extension.-->
<lxslt:component prefix="my-ext" elements="timelapse" functions="getdate">
<lxslt:script lang="javascript">
var multiplier=1;
// The methods or functions that implement extension elements always take 2
// arguments. The first argument is the XSL Processor context; the second
// argument is the element node.
function timelapse(xslProcessorContext, elem)
{
multiplier=parseInt(elem.getAttribute("multiplier"));
// The element return value is placed in the result tree.
// If you do not want a return value, return null.
return null;
}
function getdate(numdays)
{
var d = new Date();
var totalDays = parseInt(numdays) * multiplier;
d.setDate(d.getDate() + totalDays);
return d.toLocaleString();
}
</lxslt:script>
</lxslt:component>

<xsl:template match="/">
<p><my-ext:timelapse multiplier="2"/>We have logged your enquiry and will
respond by <xsl:value-of select="my-ext:getdate(string(@numdays))"/>.</p>
</xsl:template>

</xsl:stylesheet>

Posttop
(Deleted User) Subject: xalan:component
Author: (Deleted User)
Date: 26 Feb 2007 08:25 AM
Hi Maggie,
are you trying to execute this stylesheet from within Stylus, or from the Xalan command line? If the answer is 'from Stylus', which version are you running?

Thanks,
Alberto

 
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.