mkwan 2003/07/08 13:32:52
Modified: java/src/org/apache/xalan/xsltc/compiler CallTemplate.java
Stylesheet.java Template.java
Log:
Fix a few conformance regressions introduced by the addParameter
optimization work.
Revision Changes Path
1.14 +2 -2
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/CallTemplate.java
Index: CallTemplate.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/CallTemplate.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- CallTemplate.java 23 Jun 2003 18:23:14 -0000 1.13
+++ CallTemplate.java 8 Jul 2003 20:32:51 -0000 1.14
@@ -281,7 +281,7 @@
*/
public Template getCalleeTemplate() {
Stylesheet stylesheet = getStylesheet();
- Vector templates = stylesheet.getTemplates();
+ Vector templates = stylesheet.getAllValidTemplates();
int size = templates.size();
for (int i = 0; i < size; i++) {
Template t = (Template)templates.elementAt(i);
1.50 +31 -2
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.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- Stylesheet.java 25 Jun 2003 14:40:35 -0000 1.49
+++ Stylesheet.java 8 Jul 2003 20:32:51 -0000 1.50
@@ -120,6 +120,7 @@
public Stylesheet _importedFrom = null;
public Stylesheet _includedFrom = null;
+ private Vector _includedStylesheets = null;
private int _importPrecedence = 1;
private Mode _defaultMode;
private boolean _multiDocument = false;
@@ -302,10 +303,19 @@
public void setImportingStylesheet(Stylesheet parent) {
_importedFrom = parent;
+ parent.addIncludedStylesheet(this);
}
public void setIncludingStylesheet(Stylesheet parent) {
_includedFrom = parent;
+ parent.addIncludedStylesheet(this);
+ }
+
+ public void addIncludedStylesheet(Stylesheet child) {
+ if (_includedStylesheets == null) {
+ _includedStylesheets = new Vector();
+ }
+ _includedStylesheets.addElement(child);
}
public void setSystemId(String systemId) {
@@ -575,7 +585,7 @@
if (element instanceof Template) {
// Separate templates by modes
final Template template = (Template)element;
- _templates.addElement(template);
+ //_templates.addElement(template);
getMode(template.getModeName()).addTemplate(template);
}
// xsl:attribute-set
@@ -1090,5 +1100,24 @@
public Vector getTemplates() {
return _templates;
+ }
+
+ public Vector getAllValidTemplates() {
+ if (_includedStylesheets != null) {
+ Vector templates = new Vector();
+ int size = _includedStylesheets.size();
+ for (int i = 0; i < size; i++) {
+ Stylesheet included
=(Stylesheet)_includedStylesheets.elementAt(i);
+ templates.addAll(included.getAllValidTemplates());
+ }
+ templates.addAll(_templates);
+ return templates;
+ }
+ else
+ return _templates;
+ }
+
+ protected void addTemplate(Template template) {
+ _templates.addElement(template);
}
}
1.22 +5 -1
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Template.java
Index: Template.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Template.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- Template.java 23 Jun 2003 18:23:15 -0000 1.21
+++ Template.java 8 Jul 2003 20:32:51 -0000 1.22
@@ -270,6 +270,10 @@
}
}
+ if (_parent instanceof Stylesheet) {
+ ((Stylesheet)_parent).addTemplate(this);
+ }
+
parser.setTemplate(this); // set current template
parseChildren(parser);
parser.setTemplate(null); // clear template
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]