Package com.jclark.xsl.tr

Source Code of com.jclark.xsl.tr.BindLocalParamAction

// $Id: BindLocalParamAction.java 99 2005-02-28 21:37:53Z blindsey $

package com.jclark.xsl.tr;

import com.jclark.xsl.om.*;
import com.jclark.xsl.expr.VariantExpr;
import com.jclark.xsl.expr.Variant;

/**
* binds a local parameter to a name
* <xsl:param />
*/
class BindLocalParamAction implements Action
{
    private final Name name;
    private final VariantExpr expr;

    BindLocalParamAction(Name name, VariantExpr expr)
    {
        this.name = name;
        this.expr = expr;
    }

    public void invoke(ProcessContext context, Node sourceNode,
                       Result result) throws XSLException
    {
        Variant value = context.getParam(name);

        // was it passed in the context?
        if (value == null) {
            // no, use the default value
            value = expr.eval(sourceNode, context);
        }
        context.bindLocalVariable(name, value);
    }
}
TOP

Related Classes of com.jclark.xsl.tr.BindLocalParamAction

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.