[jdom-interest] TransformerException: stylesheet requires attribute: version

Laurent Bihanic laurent.bihanic at atosorigin.com
Fri Oct 11 01:02:07 PDT 2002

Your XSL namespace declaration is wrong. The only correct namespace is:
("XSL" instead of "XML" in your last attempt)


Malachi de AElfweald wrote:
> Just to clarify other issues that might be involved....
> The example below givesthis error message:
> This line will kill it.
> Exception: javax.xml.transform.TransformerConfigurationException: javax.xml.tran
> sform.TransformerException: org.jdom.JDOMException: Exception in startElement: s
> tylesheet requires attribute: version; Missing or incorrect XSLT Namespace. : st
> ylesheet requires attribute: version
> I tried to narrow the problem down.... it seems that JDOM does not correctly handle
> the xsl namespace, or I am missing something completely obvious...  This error occurs
> in non-JDOM stuff when setNamespaceAware(true) is not set... however, with JDOM, I
> don't know how to set that.  I verified that the Documents were JDOM documents by
> doing System.out.println("DOC: " + in.getClass())....  Neither the JDOMSource or StreamSource
> worked, but StreamSource stopped before "Missing or incorrect", whether it used new File(args[1])
> or just args[1]....
> I also tried (in case the error was the url):
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XML/Transform">
> -------
> xml2html.xsl (found online and added the version="1.0" to the xsl:stylesheet):
> <?xml version="1.0"?>
> <!-- Generic stylesheet for viewing XML -->
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/TR/WD-xsl">

More information about the jdom-interest mailing list