Hi, Brian.

Brian Minchau/Toronto/[EMAIL PROTECTED] wrote on 2007-09-20 02:12:05 AM:
> The problem is with 2206. Before this patch 
org.apache.xalan.xsltc.compiler
> .Stylesheet had a default value for the field _templateInlining of 
"true",
> and you couldn't actually set a non-default value.

That's not quite true.  There is a Stylesheet.setTemplateInlining(boolean) 
method, which the ApplyImports, Import, Include, and most importantly, the 
XSLTC class all reference.  The XSLTC class in particular uses the value 
of its own _templateInlining field, which has a default setting of false, 
when it calls Stylesheet.setTemplateInlining from 
XSLTC.compile(InputSource,String)

If template inlining attribute has been set to true on XSLTC's 
TransformerFactoryImpl class, the newTemplates method of XSLTC's 
TransformerFactoryImpl class passes the setting of that flag to the XSLTC 
class.  The newTemplates method is used in the implementations of the 
newTransformer and newXMLFilter methods.  So through any of those 
mechanisms, the XSLTC and Stylesheet classes will have template inlining 
set to true if it was set to true on the TransformerFactory, and false 
otherwise.

However, the XSLTC TemplatesHandler implementation does not pass through 
TransformerFactory.newTemplates to compile the stylesheet and it doesn't 
pass throught XSLTC.compile(InputSource,String).  When the 
TemplatesHandler is created, it creates an XSLTC instance, but the setting 
of the TransformerFactory's template inlining attribute never makes it to 
the XSLTC object, and the setting on the XSLTC object never makes it to 
the Stylesheet.  So it remains stuck at "true" in the Stylesheet object.

> With the patch you can set it, but the patch in 2206 also has the 
default
> value as false. I have no concerns about the patch in particular, just 
the
> default value. Although one nomally doesn't do optimization by default, 
If
> the default value is false I think that a number of users/customers 
would
> experience a performance degredation with 2.7.1.
> 
> Does anyone know whether the default value for template inlining must be
> false?

Yes, it should be false.  That's really the default value today.  Setting 
it to true results in methods that are potentially very large, because all 
templates are inlined in the main applyTemplates method generated in the 
translet.  If the Java run-time has a just-in-time compiler, it can do a 
much better job of deciding which templates ought to be inlined where 
based on actual run-time profiling information.

I believe the patch is correct.

Thanks,

Henry
------------------------------------------------------------------
Henry Zongaro      XSLT Processors Development
IBM SWS Toronto Lab   T/L 969-6044;  Phone +1 905 413-6044
mailto:[EMAIL PROTECTED]

Reply via email to