Search in sources :

Example 1 with XUnresolvedVariable

use of org.apache.xalan.templates.XUnresolvedVariable 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);
    }
}
Also used : VariableStack(org.apache.xpath.VariableStack) ElemVariable(org.apache.xalan.templates.ElemVariable) XUnresolvedVariable(org.apache.xalan.templates.XUnresolvedVariable) StylesheetRoot(org.apache.xalan.templates.StylesheetRoot) XPathContext(org.apache.xpath.XPathContext) Vector(java.util.Vector) NodeVector(org.apache.xml.utils.NodeVector) XObject(org.apache.xpath.objects.XObject)

Example 2 with XUnresolvedVariable

use of org.apache.xalan.templates.XUnresolvedVariable 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);
    }
}
Also used : VariableStack(org.apache.xpath.VariableStack) ElemVariable(org.apache.xalan.templates.ElemVariable) XUnresolvedVariable(org.apache.xalan.templates.XUnresolvedVariable) StylesheetRoot(org.apache.xalan.templates.StylesheetRoot) XPathContext(org.apache.xpath.XPathContext) Vector(java.util.Vector) NodeVector(org.apache.xml.utils.NodeVector) XObject(org.apache.xpath.objects.XObject)

Aggregations

Vector (java.util.Vector)2 ElemVariable (org.apache.xalan.templates.ElemVariable)2 StylesheetRoot (org.apache.xalan.templates.StylesheetRoot)2 XUnresolvedVariable (org.apache.xalan.templates.XUnresolvedVariable)2 NodeVector (org.apache.xml.utils.NodeVector)2 VariableStack (org.apache.xpath.VariableStack)2 XPathContext (org.apache.xpath.XPathContext)2 XObject (org.apache.xpath.objects.XObject)2