Hi,
Thank you very much for the link. I could use this information very well
(see a remark below).
However, there ist still one problem: The stylesheet uses a Xalan extension,
but (usually, see below) doesn't find the class:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:lxslt="http://xml.apache.org/xslt"
xmlns:myNamespace="mypackage.MyClass"
extension-element-prefixes="myPrefix">
..
as shown in http://xml.apache.org/xalan-j/extensions.html
brings up:
.. Line 10; Column -1; javax.xml.transform.TransformerException:
java.lang.ClassNotFoundException: mypackage.MyClass
in System.out
The stylesheet worked when I used it standalone with Xerces and Xalan (same
version)
I first put the class into
jrun/servers/default/myApp/WEB-INF/classes/mypackage/MyClass.class and also
tried it in jrun/lib/mypackage/MyClass.class.
Is this a JRun class loader issue? When I call
System.out.println("Classl:"+queryTransformer.getClass().getClassLoader());
the result is sun.misc.Launcher$AppClassLoader@7fdcde
(2 hours later)
now I found something: If you start JRun with verbose mode set
(jrun -verbose restart default) you see that it doesn't put jrun/lib into
the classpath. I put it into jrun/lib/ext and it worked.
Still, this is not what I was looking for. I expect the classloader to look
into servers/default/WEB-INF/classes as well.
Perhaps you still have a bread crumb for me.
----------------------------
Concerning your example template, Matt: the lines
Source xslSource = new StreamSource(new
java.net.URL(xslURL.toString()).openStream());
Source xmlSource = new StreamSource(new
java.net.URL(xmlURL.toString()).openStream());
// Generate the transformer.
Transformer transformer = tFactory.newTransformer(xslSource);
// Perform the transformation, sending the output to the response.
transformer.transform(xmlSource, new StreamResult(out));
will be pretty slow. It's just a demo, sure, but it may take some seconds
for the stylesheet to load. Users will probably get a little depressed when
they see this... I put this stuff into an init method that is executed only
once, which works well so far as long as the stylesheets are not changed:
import javax.xml.transform.*;
import javax.xml.transform.stream.*;
...
String templatePath = context.getRealPath("xml/myTemplate.xsl");
TransformerFactory templateFactory =
TransformerFactory.newInstance();
Templates template = templateFactory.newTemplates(new
StreamSource(new FileReader(templatePath))); // this may take a wile
(I have stripped the code a little bit, so you'd have to add exception
handling)
The conversion itself is then invoked via
StreamResult resultStream = new StreamResult(out); // JSP out
StreamSource xmlSource = new StreamSource(myXMLString)
Transformer transformer = template.newTransformer();
transformer.transform(xmlSource,resultStream);
This ought to be thread safe, isn't it? Definitely, it brings rendering down
to (in my case) a few hundred ms.
Still, however, I find the whole JAXP not very convenient to use. I think I
will need a really large book to understand it. And this is generally not a
good sign. Even worse: I can't find a good large book.
Regards,
Clemens
----- Original Message -----
From: "Matthew Horn" <[EMAIL PROTECTED]>
To: "JRun-Talk" <[EMAIL PROTECTED]>
Sent: Tuesday, September 04, 2001 4:23 PM
Subject: RE: Help! XML and JRun
> Clemens,
>
> For step by step instructions on how to do this, you can refer to the JRun
> DevCenter article "JRun and XML" at
> http://www.allaire.com/handlers/index.cfm?ID=21787
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists