use of org.apache.xalan.templates.StylesheetRoot in project robovm by robovm.
the class ProcessorLRE method getStylesheetRoot.
/**
* This method could be over-ridden by a class that extends this class.
* @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
* @return an object that represents the stylesheet element.
*/
protected Stylesheet getStylesheetRoot(StylesheetHandler handler) throws TransformerConfigurationException {
StylesheetRoot stylesheet;
stylesheet = new StylesheetRoot(handler.getSchema(), handler.getStylesheetProcessor().getErrorListener());
if (handler.getStylesheetProcessor().isSecureProcessing())
stylesheet.setSecureProcessing(true);
return stylesheet;
}
use of org.apache.xalan.templates.StylesheetRoot in project robovm by robovm.
the class TransformerImpl method pushGlobalVars.
/**
* Internal -- push the global variables from the Stylesheet onto
* the context's runtime variable stack.
* <p>If we encounter a variable
* that is already defined in the variable stack, we ignore it. This
* is because the second variable definition will be at a lower import
* precedence. Presumably, global"variables at the same import precedence
* with the same name will have been caught during the recompose process.
* <p>However, if we encounter a parameter that is already defined in the
* variable stack, we need to see if this is a parameter whose value was
* supplied by a setParameter call. If so, we need to "receive" the one
* already in the stack, ignoring this one. If it is just an earlier
* xsl:param or xsl:variable definition, we ignore it using the same
* reasoning as explained above for the variable.
*
* @param contextNode The root of the source tree, can't be null.
*
* @throws TransformerException
*/
protected void pushGlobalVars(int contextNode) throws TransformerException {
XPathContext xctxt = m_xcontext;
VariableStack vs = xctxt.getVarStack();
StylesheetRoot sr = getStylesheet();
Vector vars = sr.getVariablesAndParamsComposed();
int i = vars.size();
vs.link(i);
while (--i >= 0) {
ElemVariable v = (ElemVariable) vars.elementAt(i);
// XObject xobj = v.getValue(this, contextNode);
XObject xobj = new XUnresolvedVariable(v, contextNode, this, vs.getStackFrame(), 0, true);
if (null == vs.elementAt(i))
vs.setGlobalVariable(i, xobj);
}
}
use of org.apache.xalan.templates.StylesheetRoot in project webtools.sourceediting by eclipse.
the class XalanRootStyleFrame method fillGlobals.
private void fillGlobals(TracerEvent event) {
VariableStack vs = event.m_processor.getXPathContext().getVarStack();
StylesheetRoot sr = event.m_styleNode.getStylesheetRoot();
Vector vars = sr.getVariablesAndParamsComposed();
variables = new HashMap(vars.size());
globals = new ArrayList(vars.size());
int i = vars.size();
while (--i >= 0) {
ElemVariable variable = (ElemVariable) vars.elementAt(i);
XalanVariable xvar = new XalanVariable(this, vs, Variable.GLOBAL_SCOPE, i, variable);
addVariable(xvar);
globals.add(xvar);
}
}
use of org.apache.xalan.templates.StylesheetRoot in project j2objc by google.
the class TransformerImpl method setParameter.
/**
* Set a parameter for the templates.
*
* @param name The name of the parameter.
* @param namespace The namespace of the parameter.
* @param value The value object. This can be any valid Java object
* -- it's up to the processor to provide the proper
* coersion to the object, or simply pass it on for use
* in extensions.
*/
public void setParameter(String name, String namespace, Object value) {
VariableStack varstack = getXPathContext().getVarStack();
QName qname = new QName(namespace, name);
XObject xobject = XObject.create(value, getXPathContext());
StylesheetRoot sroot = m_stylesheetRoot;
Vector vars = sroot.getVariablesAndParamsComposed();
int i = vars.size();
while (--i >= 0) {
ElemVariable variable = (ElemVariable) vars.elementAt(i);
if (variable.getXSLToken() == Constants.ELEMNAME_PARAMVARIABLE && variable.getName().equals(qname)) {
varstack.setGlobalVariable(i, xobject);
}
}
}
use of org.apache.xalan.templates.StylesheetRoot in project j2objc by google.
the class TransformerImpl method pushGlobalVars.
/**
* Internal -- push the global variables from the Stylesheet onto
* the context's runtime variable stack.
* <p>If we encounter a variable
* that is already defined in the variable stack, we ignore it. This
* is because the second variable definition will be at a lower import
* precedence. Presumably, global"variables at the same import precedence
* with the same name will have been caught during the recompose process.
* <p>However, if we encounter a parameter that is already defined in the
* variable stack, we need to see if this is a parameter whose value was
* supplied by a setParameter call. If so, we need to "receive" the one
* already in the stack, ignoring this one. If it is just an earlier
* xsl:param or xsl:variable definition, we ignore it using the same
* reasoning as explained above for the variable.
*
* @param contextNode The root of the source tree, can't be null.
*
* @throws TransformerException
*/
protected void pushGlobalVars(int contextNode) throws TransformerException {
XPathContext xctxt = m_xcontext;
VariableStack vs = xctxt.getVarStack();
StylesheetRoot sr = getStylesheet();
Vector vars = sr.getVariablesAndParamsComposed();
int i = vars.size();
vs.link(i);
while (--i >= 0) {
ElemVariable v = (ElemVariable) vars.elementAt(i);
// XObject xobj = v.getValue(this, contextNode);
XObject xobj = new XUnresolvedVariable(v, contextNode, this, vs.getStackFrame(), 0, true);
if (null == vs.elementAt(i))
vs.setGlobalVariable(i, xobj);
}
}
Aggregations