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

Malachi de AElfweald malachi at tremerechantry.com
Fri Oct 11 04:10:25 PDT 2002

Thanks to everyone. I seem to have it fixed.

As a side note, very odd thing happened.
When I point Opera at my xml file:
it comes back as garbage
doing View:Source, and it all looks OK

change it to
and it looks file

I think it must be sending text/xml instead of text/html after doing the conversion...
not sure...

But, thanks to everyone who helped me get my conversions correct.

For posterity, a few of my routines mixed together...
this is pretty much doing an XSL conversion for the local
Document, and then preparing it for Non-Blocking I/O use.
It could be condensed, but left open for ease of reading.

	public ByteBuffer transform(InputStream stylesheet)
	throws JDOMException
			SAXBuilder builder = new SAXBuilder();
			Document styleDoc = builder.build(stylesheet);
			JDOMSource source = new JDOMSource(styleDoc);
			Transformer transformer = TransformerFactory.newInstance().newTransformer(source);
			JDOMResult result = new JDOMResult();
			transformer.transform(new JDOMSource(doc), result);
			CharArrayWriter writer = new CharArrayWriter();
			XMLOutputter xout = new XMLOutputter();
			xout.output(result.getDocument(), writer);
			char[] content=writer.toCharArray();
			CharBuffer chars = CharBuffer.allocate(content.length);
			Charset isolatin = Charset.forName("ISO-8859-1");
			ByteBuffer buffer = isolatin.newEncoder().encode(chars);
			ByteBuffer directBuffer = ByteBuffer.allocateDirect(buffer.limit());
			return directBuffer;
	    }catch (Exception e) {
	    	throw new JDOMException("XSLT Transformation failed", e);

More information about the jdom-interest mailing list