I need to read down further on the FAQ next time :)
Thanks!
Ross
Josh Canfield wrote on 1/6/2004, 3:24 PM:
See http://xml.apache.org/xalan-j/faq.html#faq-N100CB for a solutionExcerpt:The Sun JDK 1.4 is packaged with an old version (2.2D11) of Xalan-Java. The JDK 1.4 will attempt to use this version instead of any on the classpath. Unfortunately, this causes problems when attempting to use a newer version of Xalan-Java with the Sun JDK 1.4.Josh-----Original Message-----Hi all,
From: Ross Simpson [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 06, 2004 2:12 PM
To: [EMAIL PROTECTED]
Subject: xslt validation question
I'm getting an error when doing a transform.
At first everything worked great. However, when I added the following code to my xslt:
<!DOCTYPE stylesheet [
<!ENTITY nbsp "<xsl:text disable-output-escaping='yes'>&nbsp;</xsl:text>">
]>
I suddenly get loads of errors in the Tomcat log, wanting a definition for anything and everything in the template (TRs, TDs, etc. etc.).
I looked through the archives here, and it seems that the template is getting validated somehow. Other people seem to have had this problem solved by upgrading to the latest Xerces and Xalan versions.
I was going to do that, and noticed something strange.
In order to do this (and because it was necessary for other reasons), I did a brand new j2sdk 1.4.3 / tomcat 5.0.16 install.
Just for fun, I tried running my jsp page that does the transform _before_ I installed the latest Xalan, and to my complete surprise, it ran and completed the transform (albeit with the above errors).
I installed Xalan anyhow, and made sure that the provided jar files are in Tomcat's classpath, but nothing changed; I still get the errors.
Does this make sense to anyone? I don't know a whole lot about Tomcat or jsp, but how is the transform happening without Xalan installed? I ensured that there were no stray copies lying around in the classpath. Here's the code I'm using to do the transform:
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer;
// Setup input and output streams
DOMSource xmlSource = new DOMSource(xmlDoc);
StreamSource xslSource = new StreamSource(getServletContext().getRealPath("templates/map.xsl"));
StreamResult outXml = new StreamResult(outHtml);
try {
transformer = tFactory.newTransformer(xslSource);
transformer.setParameter("formUrl", config.getProperty("BASEURL") + "map.jsp");
transformer.transform(xmlSource, outXml);
}
and here's a sampling of the errors:
[Error] map_query.xsl:5:80: Element type "xsl:stylesheet" must be declared.
[Error] map_query.xsl:7:28: Element type "xsl:template" must be declared.
[Error] map_query.xsl:8:29: Element type "xsl:param" must be declared.
[Error] map_query.xsl:10:57: Element type "form" must be declared.
[Error] map_query.xsl:11:89: Element type "input" must be declared.
[Error] map_query.xsl:12:54: Element type "input" must be declared.
[Error] map_query.xsl:14:67: Element type "table" must be declared.
[Error] map_query.xsl:16:9: Element type "tr" must be declared.
[Error] map_query.xsl:17:25: Element type "td" must be declared.
[Error] map_query.xsl:18:66: Element type "img" must be declared.
Does anyone have any insight into my problem(s)?
Thanks!
Ross Simpson