mmidy 00/10/11 15:11:02
Modified: java/src/org/apache/xalan/templates Stylesheet.java
StylesheetComposed.java
Log:
Make sure upper level elements are being properly overiden for imported and
included stylesheets.
Revision Changes Path
1.8 +14 -4
xml-xalan/java/src/org/apache/xalan/templates/Stylesheet.java
Index: Stylesheet.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/Stylesheet.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Stylesheet.java 2000/10/03 20:15:48 1.7
+++ Stylesheet.java 2000/10/11 22:11:01 1.8
@@ -491,6 +491,8 @@
{
if(null == m_DecimalFormatDeclarations)
m_DecimalFormatDeclarations = new Stack();
+ // Elements are pushed in by order of importance
+ // so that when recomposed, they get overiden properly.
m_DecimalFormatDeclarations.push(edf);
}
@@ -709,7 +711,9 @@
{
m_attributeSets = new Vector();
}
- m_attributeSets.addElement(attrSet);
+ // Insert elements by order of importance so that
+ // during recompose, they get properly overiden.
+ m_attributeSets.insertElementAt(attrSet, 0);
}
/**
@@ -747,7 +751,9 @@
{
if(null == m_topLevelVariables)
m_topLevelVariables = new Vector();
- m_topLevelVariables.addElement(v);
+ // Always insert variables by order of importance so that
+ // during recompose, they get properly overiden.
+ m_topLevelVariables.insertElementAt(v, 0);
}
/**
@@ -804,7 +810,9 @@
{
if(null == m_topLevelParams)
m_topLevelParams = new Vector();
- m_topLevelParams.addElement(v);
+ // Always insert parameters by order of importance so that
+ // during recompose, they get properly overiden.
+ m_topLevelParams.insertElementAt(v, 0);
}
/**
@@ -900,7 +908,9 @@
{
if (m_prefix_aliases == null)
m_prefix_aliases = new Vector();
- m_prefix_aliases.addElement(na);
+ // Always insert elements by order of importance so that
+ // during recompose, they get properly overiden.
+ m_prefix_aliases.insertElementAt(na, 0);
}
/**
1.9 +12 -4
xml-xalan/java/src/org/apache/xalan/templates/StylesheetComposed.java
Index: StylesheetComposed.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/StylesheetComposed.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- StylesheetComposed.java 2000/10/02 02:43:07 1.8
+++ StylesheetComposed.java 2000/10/11 22:11:01 1.9
@@ -458,7 +458,9 @@
for(int vIndex = 0; vIndex < nVariables; vIndex++)
{
ElemVariable elemVar = stylesheet.getVariable(vIndex);
- m_variables.put(elemVar.getName(), elemVar);
+ // Don't overide higher priority variable
+ if (m_variables.get(elemVar.getName())== null)
+ m_variables.put(elemVar.getName(), elemVar);
}
// Do the included stylesheets contain it?
@@ -470,7 +472,9 @@
for(int vIndex = 0; vIndex < nVariables; vIndex++)
{
ElemVariable elemVar = included.getVariable(vIndex);
- m_variables.put(elemVar.getName(), elemVar);
+ // Don't overide higher priority variable
+ if (m_variables.get(elemVar.getName())== null)
+ m_variables.put(elemVar.getName(), elemVar);
}
}
}
@@ -518,7 +522,9 @@
for(int vIndex = 0; vIndex < nVariables; vIndex++)
{
ElemParam elemVar = stylesheet.getParam(vIndex);
- m_params.put(elemVar.getName(), elemVar);
+ // Don't overide higher priority parameter
+ if (m_params.get(elemVar.getName())== null)
+ m_params.put(elemVar.getName(), elemVar);
}
// Do the included stylesheets contain it?
@@ -530,7 +536,9 @@
for(int vIndex = 0; vIndex < nVariables; vIndex++)
{
ElemParam elemVar = included.getParam(vIndex);
- m_params.put(elemVar.getName(), elemVar);
+ // Don't overide higher priority parameter
+ if (m_params.get(elemVar.getName())== null)
+ m_params.put(elemVar.getName(), elemVar);
}
}
}