|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
XSLT entension - Help Needed Urgently.
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="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:java="http://xml.apache.org/xalan/java" 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> <p>Date: <xsl:value-of select="java:HelloDate.getDate($date, $format)"/></p> </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 running. Regards |
|
#2
|
|||
|
|||
|
you've declared your java namespace to be: xmlns:java="http://xml.apache.org/xalan/java"
I doubt you have your java file there; try changing it to the class path where your java class is. I'm sorry but I forget the exact syntax.. see http://www.xslt.com/html/xsl-list/2002-06/msg00388.html or http://www.biglist.com/lists/xsl-list/archives/200401/msg00037.html for a better answer |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > XSLT entension - Help Needed Urgently. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|