Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > XSLT Exception: FATAL ERROR: 'Could not compile stylesheet'

Reply
Thread Tools

XSLT Exception: FATAL ERROR: 'Could not compile stylesheet'

 
 
vinnuavc vinnuavc is offline
Junior Member
Join Date: Jul 2008
Posts: 1
 
      07-25-2008
Hi....

Am getting Folowing Exception while parsing the XSL file. Am using java 1.4 and MSXML4.2 SP2 parser andSDK.
but when I installed SQLServer2005, with that MSXML 6.0 Parser is Installed.
It is working fine before instalation of SQLServer2005.

java.lang.NullPointerException
at com.sun.org.apache.xalan.internal.xsltc.compiler.F unctionCall.translate(FunctionCall.java:826)
at com.sun.org.apache.xalan.internal.xsltc.compiler.V alueOf.translate(ValueOf.java:114)
at com.sun.org.apache.xalan.internal.xsltc.compiler.S yntaxTreeNode.translateContents(SyntaxTreeNode.jav a:490)
at com.sun.org.apache.xalan.internal.xsltc.compiler.X slAttribute.translate(XslAttribute.java:252)
..................
Compiler warnings:
file:///F:/Data/JRun4/servers/ABC/MainXSL.xsl: line 155: Attribute 'LenderBranchIdentifier' outside of element.
file:///F:/Data/JRun4/servers/ABC/MainXSL.xsl: line 156: Attribute 'LenderRegistrationIdentifier' outside of element.
..........
ERROR: 'null'
FATAL ERROR: 'Could not compile stylesheet'
javax.xml.transform.TransformerConfigurationExcept ion: Could not compile stylesheet
at com.sun.org.apache.xalan.internal.xsltc.trax.Trans formerFactoryImpl.newTemplates(TransformerFactoryI mpl.java:753)
at com.sun.org.apache.xalan.internal.xsltc.trax.Trans formerFactoryImpl.newTransformer(TransformerFactor yImpl.java:54
at com.ls.lsglobal.common.CLOUTSQLXML.TransXml2Xml(CL OUTSQLXML.java:274)

And My XSL is

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.5" xmlns:lsjava1="com.ls.lsglobal.common" xmlnssl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="lsjava1" >
<xslutput method="xml" indent="yes" encoding="utf-8" doctype-system="MyRequest.1.3.DTD"/>
<xsl:template match="/" >
<REQUEST_GROUP>

<TRANSMITTAL_DATA>
<xsl:if test="AppraisedVal!=''">
<xsl:attribute name="AppraisedValueAmount"><xsl:value-of select="AppraisedVal"/></xsl:attribute>
</xsl:if>
<xsl:if test="StatedVal!=''">
<xsl:attribute name="EstimatedValueAmount"><xsl:value-of select="StatedVal"/></xsl:attribute>
</xsl:if>

<xsl:for-each select="ROOT/AppMain/MyLoop/Liab">
<xsl:if test=" normalize-space(LiabTypCd) = 'SMG' and (normalize-space(PresFutTypCd) = 'BOTH' or normalize-space(PresFutTypCd) = 'PRES') and PresLienPos='1' and normalize-space(RefCd) != 'LOAN'">
<xsl:attribute name="CurrentFirstMortgageHolderType"><xsl:value-of select="LiabId"/></xsl:attribute>
</xsl:if>
</xsl:for-each>
<xsl:attribute name="LenderBranchIdentifier">0001</xsl:attribute>
<xsl:attribute name="LenderRegistrationIdentifier"><xsl:value-of select="ROOT/AppMain/MyNum"/></xsl:attribute>
</TRANSMITTAL_DATA>
</REQUEST_GROUP>
...............
</xsl:template>
</xsl:stylesheet>

And My Java Code is

public String TransXml2Xml(String xmlInFile, String xslFile, String xmlOutFile) throws Exception
{
try
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setIgnoringElementContentWhitespace(true);

Document document;
File stylesheet = new File(xslFile);
File dataInfile = new File(xmlInFile);

DocumentBuilder builder = factory.newDocumentBuilder();
document = builder.parse(dataInfile);
System.err.println("-->AVC::slFile="xslFile" xmlInFile="xmlInFile" xmlOutFile="+xmlOutFile);
StreamSource stylesource = new StreamSource(stylesheet);

TransformerFactory t=TransformerFactory.newInstance();
Transformer transformer = t.newTransformer(stylesource);

DOMSource source = new DOMSource(document);
javax.xml.transform.stream.StreamResult result = new javax.xml.transform.stream.StreamResult(new File(xmlOutFile));
transformer.setOutputProperty(javax.xml.transform. OutputKeys.INDENT , "yes");
transformer.setOutputProperty(javax.xml.transform. OutputKeys.ENCODING, "UTF-8");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");

if(strCLUTDTD_PATH.equals(""))
{
java.util.Properties props = new java.util.Properties();
java.io.FileInputStream fis = new java.io.FileInputStream("DataFileBasePath.properti es");
props.load(fis);
fis.close();
strCLUTDTD_PATH = checkNull(props.get("CLUTREQDTD_PATH"));
}
transformer.setOutputProperty(javax.xml.transform. OutputKeys.DOCTYPE_SYSTEM , strCLUTDTD_PATH);
transformer.transform(source, result);

}
catch(Exception e)
{
e.printStackTrace();
throw e;
}
return "";
}

can any one know what solution for this problem. It is very help full for me.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile versus not compile (VS 2005)?? stupid48@gmail.com ASP .Net 1 04-11-2008 08:24 PM
cant compile on linux system.cant compile on cant compile onlinux system. Nagaraj C++ 1 03-01-2007 11:18 AM
[xalan] FATAL ERROR: could not compile stylesheet z-man Java 5 04-14-2006 09:43 AM
How to find: Fatal exception not rethrown Jarek C++ 1 09-07-2005 09:12 AM
Fatal Python error: Interpreter not initialized (version mismatch?) - Solution Chris Matuszewski Python 0 08-24-2003 02:59 AM



Advertisments