[xsl] Xalan Extensions

Subject: [xsl] Xalan Extensions
From: "Earl Spencer" <eapencer74@xxxxxxxxxxx>
Date: Tue, 01 May 2001 14:14:46 -0000
Hi List,
I am a newbie to xml stuff and to this list i have been following the list quite for some time . Keep up the good stuff.


I have a small question for the list i just wrote a small extension and i get the following error

Call to extension function failed: method call/new failed: java.lang.NullPointerException

below are the xsl and the java files

xsl file
--------

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
               xmlns:java="http://xml.apache.org/xslt/java";
               version="1.0">
<xsl:template match="/">
  <xsl:apply-templates select="DocumentSummaries/Document"/>
</xsl:template>
 <xsl:template match="DocumentSummaries/Document">
	<xsl:variable name="st">
	    <xsl:value-of select="HtmlBody"/>
       </xsl:variable>
        <xsl:value-of select="java:stringlets.getString($st)"/>
 </xsl:template>
</xsl:stylesheet>

and this is the calss i use for the stringlets
----------------------------------------------
import java.util.*;

public class stringlets
{

 public static String getString(String str)
   {
     int ind1=str.indexOf("Source:");
	String sttt=str.substring(0,ind1);
	 return sttt;
   }
}

but i get an error
-------------------

Call to extension function failed: method call/new failed: java.lang.NullPointerException

am i dooing anything wrong please correct me.
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread