santiagopg 02/05/03 07:20:25
Modified: java/src/org/apache/xalan/xsltc/compiler ApplyImports.java
Include.java Stylesheet.java TestSeq.java
XSLTC.java
Log:
Disabling template inlining for included stylesheets.
Revision Changes Path
1.10 +2 -2
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/ApplyImports.java
Index: ApplyImports.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/ApplyImports.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ApplyImports.java 1 Feb 2002 20:07:08 -0000 1.9
+++ ApplyImports.java 3 May 2002 14:20:25 -0000 1.10
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: ApplyImports.java,v 1.9 2002/02/01 20:07:08 tmiller Exp $
+ * @(#)$Id: ApplyImports.java,v 1.10 2002/05/03 14:20:25 santiagopg Exp $
*
* The Apache Software License, Version 1.1
*
@@ -136,7 +136,7 @@
// Indicate to the top-level stylesheet that all templates must be
// compiled into separate methods.
Stylesheet stylesheet = getStylesheet();
- stylesheet.compileTemplatesAsMethods();
+ stylesheet.setTemplateInlining(false);
// Get the mode we are currently in (might not be any)
Template template = getTemplate();
1.16 +2 -1
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Include.java
Index: Include.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Include.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- Include.java 24 Apr 2002 17:03:15 -0000 1.15
+++ Include.java 3 May 2002 14:20:25 -0000 1.16
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: Include.java,v 1.15 2002/04/24 17:03:15 santiagopg Exp $
+ * @(#)$Id: Include.java,v 1.16 2002/05/03 14:20:25 santiagopg Exp $
*
* The Apache Software License, Version 1.1
*
@@ -140,6 +140,7 @@
_included.setSystemId(docToLoad);
_included.setParentStylesheet(context);
_included.setIncludingStylesheet(context);
+ _included.setTemplateInlining(context.getTemplateInlining());
// An included stylesheet gets the same import precedence
// as the stylesheet that included it.
1.40 +10 -5
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Stylesheet.java
Index: Stylesheet.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Stylesheet.java,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- Stylesheet.java 26 Apr 2002 18:14:28 -0000 1.39
+++ Stylesheet.java 3 May 2002 14:20:25 -0000 1.40
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: Stylesheet.java,v 1.39 2002/04/26 18:14:28 santiagopg Exp $
+ * @(#)$Id: Stylesheet.java,v 1.40 2002/05/03 14:20:25 santiagopg Exp $
*
* The Apache Software License, Version 1.1
*
@@ -128,7 +128,7 @@
private SourceLoader _loader = null;
- private boolean _compileTemplatesAsMethods;
+ private boolean _templateInlining = true;
private boolean _forwardReference = false;
@@ -136,8 +136,12 @@
_forwardReference = true;
}
- public void compileTemplatesAsMethods() {
- _compileTemplatesAsMethods = true;
+ public boolean getTemplateInlining() {
+ return _templateInlining;
+ }
+
+ public void setTemplateInlining(boolean flag) {
+ _templateInlining = flag;
}
public boolean isSimplified() {
@@ -410,9 +414,10 @@
parser.getSymbolTable().setCurrentNode(child);
child.parseContents(parser);
}
+
// All template code should be compiled as methods if the
// <xsl:apply-imports/> element was ever used in this stylesheet
- if (_compileTemplatesAsMethods && (child instanceof Template)) {
+ if (!_templateInlining && (child instanceof Template)) {
Template template = (Template)child;
String name = "template$dot$"+template.getPosition();
template.setName(parser.getQName(name));
1.7 +14 -12
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/TestSeq.java
Index: TestSeq.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/TestSeq.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TestSeq.java 1 Feb 2002 20:07:08 -0000 1.6
+++ TestSeq.java 3 May 2002 14:20:25 -0000 1.7
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: TestSeq.java,v 1.6 2002/02/01 20:07:08 tmiller Exp $
+ * @(#)$Id: TestSeq.java,v 1.7 2002/05/03 14:20:25 santiagopg Exp $
*
* The Apache Software License, Version 1.1
*
@@ -73,18 +73,18 @@
import org.apache.bcel.generic.*;
import org.apache.xalan.xsltc.compiler.util.*;
+/**
+ * A test sequence is a sequence of patterns that
+ *
+ * (1) occured in templates in the same mode
+ * (2) share the same kernel node type (such as A/B and C/C/B).
+ *
+ * A test sequence may have a default template, which will be run if
+ * none of the patterns do not match. This template is always a template
+ * that matches solely on the shared kernel node type.
+ */
final class TestSeq {
- /*
- * A test sequence is a sequence of patterns that
- *
- * (1) occured in templates in the same mode
- * (2) share the same kernel node type (such as A/B and C/C/B).
- *
- * A test sequence may have a default template, which will be run if
- * none of the patterns do not match. This template is always a template
- * that matches solely on the shared kernel node type.
- */
private Vector _patterns = null; // all patterns
private Mode _mode = null; // the shared mode
private Template _default = null; // the default template
@@ -107,6 +107,7 @@
public double getPriority() {
double prio = (0 - Double.MAX_VALUE);
final int count = _patterns.size();
+
for (int i = 0; i < count; i++) {
final Pattern pattern = (Pattern)_patterns.elementAt(i);
final Template template = pattern.getTemplate();
@@ -127,6 +128,7 @@
public int getPosition() {
int pos = Integer.MIN_VALUE;
final int count = _patterns.size();
+
for (int i = 0; i < count; i++) {
final Pattern pattern = (Pattern)_patterns.elementAt(i);
final Template template = pattern.getTemplate();
@@ -144,7 +146,7 @@
* Reduce the patterns in this test sequence to exclude the shared
* kernel node type. After the switch() in the translet's
applyTemplates()
* we already know that we have a hit for the kernel node type, we only
- * have the check the rest of the pattens.
+ * have the check the rest of the pattern.
*/
public void reduce() {
final Vector newPatterns = new Vector();
1.38 +3 -4
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/XSLTC.java
Index: XSLTC.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/XSLTC.java,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- XSLTC.java 24 Apr 2002 20:50:14 -0000 1.37
+++ XSLTC.java 3 May 2002 14:20:25 -0000 1.38
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: XSLTC.java,v 1.37 2002/04/24 20:50:14 santiagopg Exp $
+ * @(#)$Id: XSLTC.java,v 1.38 2002/05/03 14:20:25 santiagopg Exp $
*
* The Apache Software License, Version 1.1
*
@@ -323,10 +323,9 @@
_stylesheet.setSourceLoader(_loader);
_stylesheet.setSystemId(systemId);
_stylesheet.setParentStylesheet(null);
- if (!_templateInlining) {
- _stylesheet.compileTemplatesAsMethods();
- }
+ _stylesheet.setTemplateInlining(_templateInlining);
_parser.setCurrentStylesheet(_stylesheet);
+
// Create AST under the Stylesheet element (parse & type-check)
_parser.createAST(_stylesheet);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]