|
[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: how do java xsl processors handle xsl:import?
Subject: Re: how do java xsl processors handle xsl:import?
From: Robert Koberg <rob@xxxxxxxxxx>
Date: Mon, 01 Dec 2003 07:35:20 -0800
|
Frédéric Laurent wrote:
Robert Koberg wrote:
Hi,
How do xsl processors handle xsl:import with regard to (don't really
know how to say this) storing xsl:templates in a
javax.xml.transform.Templates object?
For sake of example, say I want to xsl:import files that contain 100
xsl:templates. The *importing* file overrides all 100 xsl:templates with
new ones. [I want to cache the javax.xml.transform.Templates object in
memory for a webapp]. Will the Templates object contain 200
xsl:templates or does it discard the overriden ones?
Take a look at the setURIResolver[1] method on the TransformerFactory
class.
These method is called by the XSLT processor when an xsl:import
function in your XSLT is found.
Then, If you write your own URIResolver [2], you can load your xsl file in
cache and give it to the XSLT Processor...
TransformerFactory factory = TransformerFactory.newInstance();
factory.setURIResolver(new MyResolver(...));
class MyResolver implements URIResolver {
public Source resolve(String href,String base) {
// manage your cache and return a Source to the Processor
}
}
Yes, this is what I currently do, however I use xsl:include for
everything thinking (perhaps incorrectly) that I would have a smaller
footprint. I mainly want to know if their are some optimizations when
using xsl:import that would give me something similar to what I am doing
with the resolver/xsl:include strategy.
best,
-Rob
[1]
http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/transform/TransformerFactory.h
tml#setURIResolver(javax.xml.transform.URIResolver)
[2] http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/transform/URIResolver.html
HTH
Fred
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list

|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
| RSS 2.0 |
|
| Atom 0.3 |
|
|