// only do this once
StaticContext env = visitor.getStaticContext();
super.checkArguments(visitor);
if (operation == EVALUATE || operation == EXPRESSION) {
NamespaceResolver nsContext = env.getNamespaceResolver();
staticContext = new IndependentContext(env.getConfiguration());
staticContext.setBaseURI(env.getBaseURI());
staticContext.setImportedSchemaNamespaces(env.getImportedSchemaNamespaces());
staticContext.setDefaultFunctionNamespace(env.getDefaultFunctionNamespace());
staticContext.setDefaultElementNamespace(env.getDefaultElementNamespace());
for (Iterator iter = nsContext.iteratePrefixes(); iter.hasNext();) {
String prefix = (String)iter.next();
if (!"".equals(prefix)) {
String uri = nsContext.getURIForPrefix(prefix, true);
staticContext.declareNamespace(prefix, uri);
}
}
details = new InstructionDetails();
details.setConstructType(Location.SAXON_EVALUATE);
details.setSystemId(env.getLocationMap().getSystemId(this.locationId));
details.setLineNumber(env.getLocationMap().getLineNumber(this.locationId));
} else if (operation == EVALUATE_NODE) {
// for saxon:evaluate-node() the static context of the expression is based
// on the node in the source document containing the expression.
staticContext = new IndependentContext(env.getConfiguration());
}
}
}