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

Malachi de AElfweald malachi at tremerechantry.com
Thu Oct 10 20:23:11 PDT 2002


I am getting the following error.

org.jdom.JDOMException: XSLT Transformation failed: javax.xml.transform.TransformerConfigurationException: 
javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: stylesheet requires attribute: version

Looking online, everyone said I had to set DocumentFactory.setNamespaceAware(true) to get rid of that error. But I am not 
using DocumentFactory, since I just using JDOM's SAXBuilder...

My transform routine needs to return a char[] so I can create a CharBuffer to create an NIO ByteBuffer....

Here's my transform routine that is causing the problem...

	public char[] transform(InputStream stylesheet)
	throws JDOMException
	{
		try{
			CharArrayWriter output = new CharArrayWriter();
			StreamSource ss = new StreamSource(stylesheet);
			
			Transformer transformer = TransformerFactory.newInstance().newTransformer(ss);
//Properties p = transformer.getOutputProperties();
//p.store(new FileOutputStream("transformer.prop"), "Transformer Configuration");
			StreamResult out = new StreamResult(output);
//			JDOMResult out = new JDOMResult(); // output may not be well-formed XML, so can't use this?
			transformer.transform(new JDOMSource(doc), out);
			
			output.flush();
			return output.toCharArray();
	    }catch (Exception e) {
	    	throw new JDOMException("XSLT Transformation failed", e);
	    }
	}


Any help would be greatly appreciated...

Malachi







More information about the jdom-interest mailing list