Hi All,
I have been trying to call my java program from xsl but it seems to give error as depicted below:
file:///C:/xslt/java/sample.xsl; Line #21; Column #60; XSLT Error (javax.xml.transform.TransformerException): javax.xml.transform.TransformerException: java.lang.ClassNotFoundException: HelloDate
I have read a lot of article and followed exactly the way but it still throws me this.
My xslt file:
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl=“XSLT Namespace”
version=“1.0”
xmlns:java=“http://xml.apache.org/xalan/java"<BR>exclude-result-prefixes="java”>
<xsl:template match=“/”>
<xsl:variable name=“date”>2004-12-20 01:01:01</xsl:variable>
<xsl:variable name=“format”>dd/mm/yyyy</xsl:variable>
Date: <xsl:value-of select=“java:HelloDate.getDate($date, $format)”/>
</xsl:template>
</xsl:stylesheet>
My java file:
import java.text.SimpleDateFormat;
import java.sql.Timestamp;
public class HelloDate
{
public static String getDate(String inputDate, String dateFormat)
{
String outPutDate = “”;
System.out.println("dateFormat " + dateFormat);
if ( inputDate != null && inputDate != “”)
{
SimpleDateFormat patternDateTimeFormat = new
SimpleDateFormat ( dateFormat );
outPutDate = patternDateTimeFormat.format
(Timestamp.valueOf ( inputDate ) );
System.out.println(outPutDate);
}
else
{
outPutDate = “”;
}
return outPutDate;
}
}
Please help to run it.