mmidy 00/08/09 10:52:01
Modified: java/src/org/apache/xalan/processor ProcessorInclude.java
java/src/org/apache/xalan/templates StylesheetComposed.java
StylesheetRoot.java
java/src/org/apache/xalan/transformer KeyWalker.java
java/src/org/apache/xpath/functions FunctionMultiArgs.java
java/src/org/apache/xpath/operations Variable.java
java/src/org/apache/xpath/res XPATHErrorResources.java
Log:
Fix misc. typos, fix warning, fix misc stuff related with recomposing
imported and included stylesheets, fix getting URI for imported/included
stylesheets
Revision Changes Path
1.4 +15 -4
xml-xalan/java/src/org/apache/xalan/processor/ProcessorInclude.java
Index: ProcessorInclude.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorInclude.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ProcessorInclude.java 2000/08/07 21:32:04 1.3
+++ ProcessorInclude.java 2000/08/09 17:51:44 1.4
@@ -70,6 +70,7 @@
import org.xml.sax.helpers.XMLReaderFactory;
import trax.URIResolver;
import org.w3c.dom.Node;
+import org.apache.xalan.utils.SystemIDResolver;
/**
* Processor class for xsl:include markup.
@@ -157,13 +158,23 @@
boolean tryCreatingReader = true;
EntityResolver entityResolver
= handler.getStylesheetProcessor().getEntityResolver();
+
+ InputSource inputSource;
+ if(null != entityResolver)
+ {
+ inputSource = entityResolver.resolveEntity(null, getHref());
+ // TODO: Check for relative URL, and absolutize it??? Or no?
+ }
+ else
+ {
+ String absURL
+ = SystemIDResolver.getAbsoluteURI(getHref(),
handler.getBaseIdentifier());
+ inputSource = new InputSource(absURL);
+ }
if(null != uriresolver)
{
tryCreatingReader = false;
- InputSource inputSource = (null != entityResolver)
- ? entityResolver.resolveEntity(null,
getHref()) :
- new InputSource(getHref());
reader = uriresolver.getXMLReader(inputSource);
if(null == reader)
{
@@ -195,7 +206,7 @@
if(null != entityResolver)
reader.setEntityResolver(entityResolver);
reader.setContentHandler(handler);
- reader.parse(getHref());
+ reader.parse(inputSource);
}
}
catch(InstantiationException ie)
1.5 +6 -6
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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- StylesheetComposed.java 2000/08/04 22:26:28 1.4
+++ StylesheetComposed.java 2000/08/09 17:51:46 1.5
@@ -225,7 +225,7 @@
int nImports = getImportCountComposed();
for(int i = -1; i < nImports; i++)
{
- StylesheetComposed stylesheet = (i == i) ? this : getImportComposed(i);
+ StylesheetComposed stylesheet = (i < 0) ? this : getImportComposed(i);
// Does this stylesheet contain it?
int nDFPs = stylesheet.getDecimalFormatCount();
for(int dfpIndex = 0; dfpIndex < nDFPs; dfpIndex++)
@@ -387,7 +387,7 @@
int nImports = getImportCountComposed();
for(int i = -1; i < nImports; i++)
{
- StylesheetComposed stylesheet = (i == i) ? this : getImportComposed(i);
+ StylesheetComposed stylesheet = (i < 0) ? this : getImportComposed(i);
// Does this stylesheet contain it?
int nAS = stylesheet.getAttributeSetCount();
for(int asIndex = 0; asIndex < nAS; asIndex++)
@@ -452,7 +452,7 @@
int nImports = getImportCountComposed();
for(int i = -1; i < nImports; i++)
{
- StylesheetComposed stylesheet = (i == i) ? this : getImportComposed(i);
+ StylesheetComposed stylesheet = (i < 0) ? this : getImportComposed(i);
// Does this stylesheet contain it?
int nVariables = stylesheet.getVariableCount();
for(int vIndex = 0; vIndex < nVariables; vIndex++)
@@ -512,7 +512,7 @@
int nImports = getImportCountComposed();
for(int i = -1; i < nImports; i++)
{
- StylesheetComposed stylesheet = (i == i) ? this : getImportComposed(i);
+ StylesheetComposed stylesheet = (i < 0) ? this : getImportComposed(i);
// Does this stylesheet contain it?
int nVariables = stylesheet.getParamCount();
for(int vIndex = 0; vIndex < nVariables; vIndex++)
@@ -625,7 +625,7 @@
int nImports = getImportCountComposed();
for(int i = -1; i < nImports; i++)
{
- StylesheetComposed stylesheet = (i == i) ? this : getImportComposed(i);
+ StylesheetComposed stylesheet = (i < 0) ? this : getImportComposed(i);
// Does this stylesheet contain it?
int nNSA = stylesheet.getNamespaceAliasCount();
for(int nsaIndex = 0; nsaIndex < nNSA; nsaIndex++)
@@ -640,7 +640,7 @@
for(int k = 0; k < nIncludes; k++)
{
Stylesheet included = stylesheet.getIncludeComposed(k);
- nNSA = included.getParamCount();
+ nNSA = included.getNamespaceAliasCount();
for(int nsaIndex = 0; nsaIndex < nNSA; nsaIndex++)
{
NamespaceAlias nsAlias = included.getNamespaceAlias(nsaIndex);
1.6 +19 -6
xml-xalan/java/src/org/apache/xalan/templates/StylesheetRoot.java
Index: StylesheetRoot.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/StylesheetRoot.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- StylesheetRoot.java 2000/07/18 01:33:33 1.5
+++ StylesheetRoot.java 2000/08/09 17:51:47 1.6
@@ -187,6 +187,7 @@
{
StylesheetComposed sheet = getGlobalImport(i);
if(sheet != this) // already done
+ {
sheet.recomposeImports();
sheet.recomposeIncludes(sheet);
sheet.recomposeAttributeSets();
@@ -197,7 +198,18 @@
sheet.recomposeTemplates();
sheet.recomposeVariables();
sheet.recomposeWhiteSpaceInfo();
- }
+ }
+ }
+ recomposeIncludes(this);
+ recomposeAttributeSets();
+ recomposeDecimalFormats();
+ recomposeKeys();
+ recomposeNamespaceAliases();
+ recomposeParams();
+ recomposeTemplates();
+ recomposeVariables();
+ recomposeWhiteSpaceInfo();
+
}
/**
@@ -321,7 +333,7 @@
* list. The will be added from highest import precedence to
* least import precidence.
*/
- protected void addImports(Stylesheet stylesheet)
+ protected void addImports(Stylesheet stylesheet, boolean addToList)
{
// Get the direct imports of this sheet.
int n = stylesheet.getImportCount();
@@ -331,7 +343,7 @@
{
Stylesheet imported = stylesheet.getImport(i);
m_globalImportList.insertElementAt(imported, 0);
- addImports(imported);
+ addImports(imported, false);
}
}
@@ -341,10 +353,11 @@
for(int i = 0; i < n; i++)
{
Stylesheet included = stylesheet.getInclude(i);
- addImports(included);
+ addImports(included, false);
}
}
- m_globalImportList.insertElementAt(stylesheet, 0);
+ if(addToList)
+ m_globalImportList.insertElementAt(stylesheet, 0);
}
/**
@@ -366,7 +379,7 @@
for(int i = 0; i < n; i++)
{
StylesheetComposed imported = getImport(i);
- addImports(imported);
+ addImports(imported, true);
}
m_globalImportList.insertElementAt(this, 0);
}
1.3 +2 -0
xml-xalan/java/src/org/apache/xalan/transformer/KeyWalker.java
Index: KeyWalker.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/KeyWalker.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- KeyWalker.java 2000/07/05 14:42:53 1.2
+++ KeyWalker.java 2000/08/09 17:51:50 1.3
@@ -105,6 +105,8 @@
if(!kd.getName().equals(name))
continue;
+ ki.getXPathContext().setNamespaceContext(ki.getPrefixResolver());
+
// See if our node matches the given key declaration according to
// the match attribute on xsl:key.
double score = kd.getMatch().getMatchScore(ki.getXPathContext(),
testNode);
1.2 +16 -10
xml-xalan/java/src/org/apache/xpath/functions/FunctionMultiArgs.java
Index: FunctionMultiArgs.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FunctionMultiArgs.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FunctionMultiArgs.java 2000/07/05 14:46:48 1.1
+++ FunctionMultiArgs.java 2000/08/09 17:51:54 1.2
@@ -11,16 +11,22 @@
{
if(argNum < 3)
super.setArg(arg, argNum);
- else if(null == m_args)
- m_args = new Expression[1];
- else
- {
- // Slow but space conservative.
- Expression[] args = new Expression[m_args.length+1];
- System.arraycopy(m_args, 0, args, 0, m_args.length);
- args[m_args.length] = arg;
- m_args = args;
- }
+ else
+ {
+ if(null == m_args)
+ {
+ m_args = new Expression[1];
+ m_args[0] = arg;
+ }
+ else
+ {
+ // Slow but space conservative.
+ Expression[] args = new Expression[m_args.length+1];
+ System.arraycopy(m_args, 0, args, 0, m_args.length);
+ args[m_args.length] = arg;
+ m_args = args;
+ }
+ }
}
public void checkNumberArgs(int argNum)
1.2 +2 -2
xml-xalan/java/src/org/apache/xpath/operations/Variable.java
Index: Variable.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xpath/operations/Variable.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Variable.java 2000/07/05 14:48:19 1.1
+++ Variable.java 2000/08/09 17:51:56 1.2
@@ -32,13 +32,13 @@
}
catch(Exception e)
{
- error(xctxt, XPATHErrorResources.ER_COULDNOT_GET_VAR_NAMED, new
Object[] {m_qname}); //"Could not get variable named "+varName);
+ error(xctxt, XPATHErrorResources.ER_COULDNOT_GET_VAR_NAMED, new
Object[] {m_qname.getLocalPart()}); //"Could not get variable named "+varName);
result = null;
}
if(null == result)
{
- warn(xctxt, XPATHErrorResources.ER_ILLEGAL_VARIABLE_REFERENCE, new
Object[] {m_qname}); //"VariableReference given for variable out "+
+ warn(xctxt, XPATHErrorResources.WG_ILLEGAL_VARIABLE_REFERENCE, new
Object[] {m_qname.getLocalPart()}); //"VariableReference given for variable out
"+
result = new XNodeSet();
}
1.2 +8 -1
xml-xalan/java/src/org/apache/xpath/res/XPATHErrorResources.java
Index: XPATHErrorResources.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xpath/res/XPATHErrorResources.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XPATHErrorResources.java 2000/07/05 14:49:05 1.1
+++ XPATHErrorResources.java 2000/08/09 17:51:58 1.2
@@ -77,7 +77,7 @@
public static final String WARNING_SUFFIX = "WR";
public static final int MAX_CODE = 68; // this is needed to
keep track of the number of messages
- public static final int MAX_WARNING = 10; // this is needed to
keep track of the number of warnings
+ public static final int MAX_WARNING = 11; // this is needed to
keep track of the number of warnings
public static final int MAX_OTHERS = 20;
public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING +1;
@@ -666,6 +666,13 @@
{
contents[WG_EXPAND_ENTITIES_NOT_SUPPORTED + MAX_CODE][1]
= "-E option not supported for DTM parser";
+ }
+
+ public static final int WG_ILLEGAL_VARIABLE_REFERENCE = 11;
+ static
+ {
+ contents[WG_ILLEGAL_VARIABLE_REFERENCE + MAX_CODE][1]
+ = "VariableReference given for variable out of context or without
definition! Name = {0}";
}
// Other miscellaneous text used inside the code...