Project

Profile

Help

Changing a template for a Transformer

Added by Anonymous about 19 years ago

Legacy ID: #3145736 Legacy Poster: Curtis (cdfisher07)

Given the following: SaxonTransform sax = new SaxonTransform("net.sf.saxon.TransformerFactoryImpl","login.xsl"); try { sax.setTemplateParameters(params); status = sax.applyTrans("", "schedule.xml"); whose object constructor caches the stylesheet and creates a new member Transformer as such: pss = tryCache(styleSheet); transformer = pss.newTransformer(); How can I change the style sheet on this instance? Is there further functionality that Saxon offers that would allow something like: sax.swapStylesheet("sheet.xls") to be programmed? Or do I just create a new Transfomer and go with that? Thanks... Curis Fisher


Replies (2)

RE: Changing a template for a Transformer - Added by Anonymous about 19 years ago

Legacy ID: #3145888 Legacy Poster: Michael Kay (mhkay)

Once you've created a Transformer it's irrevocably bound to a particular stylesheet. If you want to use a different stylesheet, create a new Transformer. I don't recommend reusing a Transformer even if you're using the same stylesheet, unless you are particularly keen to hold on to the DocumentPool, which holds the documents read using the document() and doc() functions during the course of a transformation. You can reuse the transformer and clear the document pool, but there's then little point. Michael Kay

RE: Changing a template for a Transformer - Added by Anonymous about 19 years ago

Legacy ID: #3145996 Legacy Poster: Curtis (cdfisher07)

Thanks, just what I needed to know... As an aside, I agree completely that the refrerence utility of your XSLT 2.0 is lowered because of the WROX decision to omit the markings of the 2nd Edition. I would like to see your book on Safari to make it infinitely more searchable. There is so much information, I continuously find bits of knowledge at odd points when reviewing material, then promptly forget about where the location is, and later have to search furiously to find something that I know exists, yet eludes my feeble memory. Thanks again... Curtis Fisher

    (1-2/2)

    Please register to reply