[jdom-interest] Problems with Transform

Ian Lea ian.lea at blackwell.co.uk
Tue Jun 5 02:17:32 PDT 2001


Can't help you on the stream buffer stuff, but may be able to
help on the sample transforms if you are talking about
jdom/samples/XSLTransform.java.

Sample session that works for me:

$ cd jdom/samples
$ CLASSPATH=./:../lib/xalan.jar:../build/jdom.jar:../lib/crimson.jar
$ export CLASSPATH
$ javac XSLTransform.java
$ java XSLTransform catalog.xml catalog.xsl
<?xml version="1.0" encoding="UTF-8"?>
<html> 
etc.


So "String stylesheet" is the path to the .xsl file, the transformation
itself is done by Xalan so that does need to be on your CLASSPATH, and
I'm not using NetBeans so don't know if that is relevant or not.



Hope this helps.


--
Ian.
ian.lea at blackwell.co.uk


"Schuetz, David" wrote:
> 
> Hi, all...
> 
> ...I'm new to JDOM (not to mention Java), and have been muddling through
> some of the simple examples and built a pretty simple tree-populating xml
> reader.  I started playing with transforms, using the example referred to on
> the JDOM site (with Xalan and all the streams and such), but I quickly ran
> into the strange stream buffer closing problem (interestingly, it only
> occurs for a file > 1024 bytes -- at or below exactly 1024, it works
> fine...might just be a coincidence).
> 
> Anyway, I downloaded the latest from CVS, got the contrib stuff, etc., and
> have been trying to get that to work, instead.  And having problems, too.
> 
> I'm using the XSL Transform sample file.  First question -- for the "String
> stylesheet" variable -- is that to be a pathname to a file, or the actual
> *contents* of the XSL sheet itself?  I've tried just using a filename, and
> I've tried also creating a new java.io.File variable that (I think) is
> connected to the stylesheet pathname.  Nothing seems to work.
> 
> Currently, as far as I can tell, the transform method isn't doing anything.
> That is, "doc2 = transform(....)" doesn't return anything but NULL for doc2,
> and so subsequent things (like, say, the xmloutputter) fail nicely.
> 
> Am I missing anything here (essentially, are there any FAQs about this,
> things I need to keep in mind)?  Doing anything stupid?  How can I further
> debug this? (I havent tried going into the source for transform, 'cause
> that's a Xalan piece, right?)  I'm using NetBeans, and I *think* I've got
> the proper Xalan jar file mounted.  I can provide more detail if it's needed
> (if there isn't a FAQ about this...)
> 
> Thanks!
> 
> david.



More information about the jdom-interest mailing list