File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes Using xsl:import but i throws NullPointerException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Using xsl:import but i throws NullPointerException" Watch "Using xsl:import but i throws NullPointerException" New topic
Author

Using xsl:import but i throws NullPointerException

Bikramjit Singh Bajwa
Ranch Hand

Joined: Nov 23, 2003
Posts: 39
Hi Guys,
I facing a weird problem and need urgent solution. My code and error is below:
<b>Code:</b>
1. XML (Data.xml)
<data>
<item>Hello</item>
</date>
2. XSL (Temp.xsl)
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl utput method="html" />
<xsl:include href="TempInclude.xsl" />
<xsl:template match="Gems">
<xsl:call-template name="firstTemplate" />
</xsl:template>

</xsl:stylesheet>
3. XSL (TempInclude.xsl)
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template name="firstTemplate">
Help me guys
</xsl:template>
</xsl:stylesheet>
<b>Error:</b>
java.lang.NullPointerException
com.icl.saxon.style.XSLGeneralIncorporate.getIncludedStyleSheet(XSLGeneralIncorporate.java:104)
com.icl.saxon.style.XSLStyleSheet.spliceIncludes(XSLStyleSheet.java:421)
com.icl.saxon.style.XSLStyleSheet.preprocess(XSLStyleSheet.java:346)
com.icl.saxon.PreparedStyleSheet.setStyleSheetDocument(PreparedStyleSheet.java:176)
com.icl.saxon.PreparedStyleSheet.prepare(PreparedStyleSheet.java:133)
com.icl.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:127)
com.icl.saxon.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:79)
org.apache.taglibs.standard.tag.common.xml.TransformSupport.doStartTag(Unknown Source)
org.apache.taglibs.standard.tag.el.xml.TransformTag.doStartTag(Unknown Source)
org.apache.jsp.InfoPackageData_jsp._jspService(InfoPackageData_jsp.java:376)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:320)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:293)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

I am accessing all this with the help of JSP and all of my files are placed in the same directory and i am getting the following error. Kindly help me ASAP. I shall be very thankfull to you all.
Chakk de..

Bikramjit Singh Bajwa
Ranch Hand

Joined: Nov 23, 2003
Posts: 39
Hi,
Forget to tell you, while including second xsl file into first xsl file. I am getting this error. This is just becaz of including xsl.I guess, i am missing something or anything required ?
Thanks in Advance
Bikram
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Maybe you should consider writing your custom javax.xml.transform.URIResolver ?


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Bikramjit Singh Bajwa
Ranch Hand

Joined: Nov 23, 2003
Posts: 39
yuhooooo
I just used latest saxon parser and it starts working.
Any way thanks alot Lasse
Bikram
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using xsl:import but i throws NullPointerException