Matthias Carlsson <[EMAIL PROTECTED]> wrote:
>>
>>
>> Those numbers seem AWFULLY wrong... The parse time is right, but the
>> transformation... NAAAAH... Can you check out using the JAXP-1.1 package
>> from Sun (including the Apache CRIMSON parser and the Apache XALAN XSL
>> transformer version 2.0)... Those should significantly reduce the time...
>>
>> Pier
>>
>
> This is code I'm currently using to transform my XML-documents (Xalan 1.21):
>
> String xslDocument = <path-to-xsl-document-to-use>
>
> XSLTProcessorFactory.getProcessor().process(
> new XSLTInputSource(document),
> new XSLTInputSource("file:///" + xslDocument),
> //new XSLTInputSource(new FileReader(xslDocument)),
> new XSLTResultTarget(response.getOutputStream())
> );
>
> As you can see, I'm currently passing the path to the XSL-document like
> this:
> "file:///" + xslDocument
> Even I can see it isn't meant to be done in that way. But, when using the
> commented line instead with the FileReader-object, the current working
> directory
> gets screwed up.
>
> In my XSL-documents, I use following line to include another XSL-document:
>
> <xsl:include href="default.xsl" />
>
> With that line, I expect it to look for default.xsl in the same directory as
> the
> the original file. However, when using the FileReader above, the
> "current working directory" gets set to E:\Tomcat\bin - the dir where I
> start my
> servlet engine. When using "file:///" + <path-to-xsl>, the dir is correctly
> set.
>
> I don't know if this is a bug or if I'm doing something wrong. I've tried to
> switch
> to Xalan 2.00, but I've been unable to get it to work.
>
> If anyone has a code example showing how to transform a DOM-object with a
> XSL-document
> (loaded from a file) I'd really appreciate if you could send it.
I can see why it would be slow (but those numbers you gave me were AWFULLY
too wrong...
Instead of building the XSLT processor per every request, create it in the
init() method and cache it from one request to another, that should work
better...
Anyway, check out JAXP-1.1, the specification gives a lot of examples...
Pier
--
----------------------------------------------------------------------------
Pier Fumagalli - Sun Microsystems Inc. - <mailto:[EMAIL PROTECTED]>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html