Dear All, I am using JSTL transform tag to transform the xml using XSLT. I am using the following code: <c:import url="/resources/homepages/syncdiff/xsl/syncdiff.xsl" var="xslt"/> <x:transform xml="${adapterUDMVar}" xslt="${xslt}" /> and the xml used is as given below : <UDM xmlns="http://www.cramer.com/udm" versionNumber="1.0" generatedBy="Netman Aps" source="ResourceManager" UDMDateTime="2004-07-14T14:38:08"/> I am getting the following error: java.lang.IllegalStateException: can't declare any more prefixes in this context but this error goes if I remove the xmlns:udm="http://www.cramer.com/udm" attribute from UDM tag. Could anyone tell me what could be the problem? Cheers kk
Please note that if I provide the xml via a <c:set tag it works <c:set var="adapterUDMVar" value="<UDM xmlns=\"http://www.cramer.com/udm\" xmlns:udm=\"http://www.cramer.com/udm\" versionNumber=\"1.0\" generatedBy=\"Netman Aps\" source=\"ResourceManager\" UDMDateTime=\"2004-07- 14T14:38:08\"/> Any body knows why this is happening? Cheers kk
I get a similar error in tomcat 5 when parsing some XML files. They work OK in tomcat 4.0 (same machine, jvm, webapp etc) I havnt had a chance to chase this further, but this may help someone elses dignosis
The same for me. But one think: If I start the tomcat as the service, I get the specified error. When I start it using startup.bat everythink is working OK. The error is: java.lang.IllegalStateException: can't declare any more prefixes in this context at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:658) at org.apache.crimson.parser.Parser2.parse(Parser2.java:333) at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
This is a JSTL/Standard issue, not XTags. Anyway, could you please provide more info, like with version of Standard and Tomcat you are using, the JDK version, the URI for the URL and what do you have on WEB-INF/lib? This looks like an XML parsing issue... -- Felipe
I have two taglib includes at the top of my JSP. One for the jstl core and one for jstl xml. When I try the transformation I get a similair error (java.lang.IllegalStateException: can't declare any more prefixes in this context) . When I remove one of the taglibs I get a different error. I am running tomcat 5.0.28 on the Java SDK 1.4.2_05 on windows. Tomcat is running as a service. Here is an example of the jsp: <%@ page language="java" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %> <html> <head> <title>XML Test</title> </head> <body bgcolor="white"> <center> <c:import url="http://localhost:8080/jsp-examples/test/note.xml" var="myxml" /> <c:import url="http://localhost:8080/jsp-examples/test/note.xsl" var="myxslt" /> <x:transform xml="${myxml}" xslt="${myxslt}" /> </center> </body> </html> The xml to parse: <?xml version="1.0"?> <note> <to>Pete</to> <from>Franco</from> <heading>Example</heading> <body>My JSP XML transformation!</body> </note> And finally the xslt: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="note"> <table border="0" width="50%"> <tr> <td>From:</td> <td><xsl:value-of select="from"/></td> </tr> <tr> <td>To:</td> <td><xsl:value-of select="to"/></td> </tr> <tr> <td>Title:</td> <td><xsl:value-of select="heading"/></td> </tr> <tr> <td>Message:</td> <td><xsl:value-of select="body"/></td> </tr> </table> </xsl:template> </xsl:stylesheet> Within my WEB-INF/lib folder I only have two jars, namely jslt.jar and standard.jar
Try installing the latest version of Xalan (2.6.0, I believe) in $CATALINA_HOME/common/endorsed. You can get Xalan from: http://www.apache.org/dyn/closer.cgi/xml/xalan-j Make sure to also install the version of Xerces that is included with Xalan. So, $CATALINA_HOME/common/endorsed should have: xalan.jar xercesImpl.jar xml-apis.jar All those JAR files should come from the Xalan version you download.
Thanks Kris, Adding xalan.jar xercesImpl.jar xml-apis.jar To the commons/endorsed folder solved the problem..
Resolving as INVALID since it appears to be working as expected with appropriate versions of Xerces and Xalan.
This may actually be a bad SAX hygeine issue; fiddling with library versions may just be getting you to an older and more permissive version of SAX. See http://blogs.fivesight.com/pbblog/index.php?p=45