Velocity Reviews - Computer Hardware Reviews

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

Thread Tools

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

vinnuavc vinnuavc is offline
Junior Member
Join Date: Jul 2008
Posts: 1

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.

at unctionCall.translate(
at alueOf.translate(
at yntaxTreeNode.translateContents(SyntaxTreeNode.jav a:490)
at slAttribute.translate(
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 formerFactoryImpl.newTemplates(TransformerFactoryI
at formerFactoryImpl.newTransformer(TransformerFactor

And My XSL is

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.5" xmlns:lsjava1="" xmlnssl="" exclude-result-prefixes="lsjava1" >
<xslutput method="xml" indent="yes" encoding="utf-8" doctype-system="MyRequest.1.3.DTD"/>
<xsl:template match="/" >

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

<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:attribute name="LenderBranchIdentifier">0001</xsl:attribute>
<xsl:attribute name="LenderRegistrationIdentifier"><xsl:value-of select="ROOT/AppMain/MyNum"/></xsl:attribute>

And My Java Code is

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

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); result = new File(xmlOutFile));
transformer.setOutputProperty(javax.xml.transform. OutputKeys.INDENT , "yes");
transformer.setOutputProperty(javax.xml.transform. OutputKeys.ENCODING, "UTF-8");
transformer.setOutputProperty("{}indent-amount", "2");

java.util.Properties props = new java.util.Properties(); fis = new"DataFileBasePath.properti es");
strCLUTDTD_PATH = checkNull(props.get("CLUTREQDTD_PATH"));
transformer.setOutputProperty(javax.xml.transform. OutputKeys.DOCTYPE_SYSTEM , strCLUTDTD_PATH);
transformer.transform(source, result);

catch(Exception e)
throw e;
return "";

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

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)?? 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