5

I have been trying to compile xslt file into java class and keep getting this errors. Not sure what I am doing wrong here:

java com.sun.org.apache.xalan.internal.xsltc.cmdline.Compile test.xslt

java.lang.NullPointerException
at com.sun.org.apache.xalan.internal.xsltc.compiler.Parser.parse(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC.compile(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC.compile(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC.compile(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.cmdline.Compile.main(Unknown Source)
Compiler errors:
Could not compile stylesheet

my test.xslt file:

 <?xml version="1.0"?> 
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">  
   <xsl:template match="/hello-world">
     <HTML>
       <HEAD>
         <TITLE></TITLE>
       </HEAD>
       <BODY>
         <H1>
           <xsl:value-of select="greeting"/>
         </H1>
         <xsl:apply-templates select="greeter"/>
       </BODY>
     </HTML>   </xsl:template>   <xsl:template match="greeter">
     <DIV>from <I><xsl:value-of select="."/></I></DIV>   
  </xsl:template> 
</xsl:stylesheet>
6
  • 1
    Are the greater than signs (>) part of your .xslt file? Commented Feb 26, 2014 at 0:46
  • you mean closing tag sign (>)? Yes, it is part of it. Commented Feb 26, 2014 at 1:13
  • No initially in the file, every line started with a closing tag sign. Other question: what command did you use to compile the file? Commented Feb 26, 2014 at 1:39
  • java com.sun.org.apache.xalan.internal.xsltc.cmdline.Compile test.xslt Commented Feb 26, 2014 at 1:53
  • am able to compile ...change the test.xslt to test.xsl and try Commented Feb 26, 2014 at 4:46

1 Answer 1

3

Try the version of Xalan from Apache. It's generally more reliable than the version that ships with the JDK.

Sign up to request clarification or add additional context in comments.

1 Comment

It's not mine... It's one of my competitors! But if the answer works, please accept it. Not that I care about the brownie points (I'm too old for that), but the green tick-mark is helpful to subsequent readers of the thread.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.