Example usage for org.dom4j.rule Action Action

List of usage examples for org.dom4j.rule Action Action

Introduction

In this page you can find the example usage for org.dom4j.rule Action Action.

Prototype

Action

Source Link

Usage

From source file:org.apache.commons.jelly.tags.jsl.JellyStylesheet.java

License:Apache License

public JellyStylesheet() {
    setValueOfAction(new Action() {
        public void run(Node node) throws Exception {
            String text = node.getStringValue();
            if (text != null && text.length() > 0) {
                getOutput().write(text);
            }//from ww  w  .j a  va2  s. c o  m
        }
    });
}

From source file:org.apache.commons.jelly.tags.jsl.TemplateTag.java

License:Apache License

protected Action createAction(final StylesheetTag tag, final XMLOutput output) {
    return new Action() {
        public void run(Node node) throws Exception {

            // store the context for use by applyTemplates tag
            tag.setXPathSource(node);/* ww w .  j a v  a  2s .  co  m*/

            xpathSource = node;

            if (log.isDebugEnabled()) {
                log.debug("Firing template body for match: " + match + " and node: " + node);
            }

            XMLOutput actualOutput = tag.getStylesheetOutput();
            if (actualOutput == null) {
                actualOutput = output;
            }

            invokeBody(actualOutput);
        }
    };
}