1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.commons.jelly.tags.jsl;
17
18 import org.apache.commons.jelly.XMLOutput;
19
20 import org.apache.commons.logging.Log;
21 import org.apache.commons.logging.LogFactory;
22
23 import org.dom4j.Node;
24 import org.dom4j.rule.Action;
25 import org.dom4j.rule.Stylesheet;
26
27 /***
28 * This class is a specialization of the Stylesheet from dom4j's rule engine
29 * that adds some Jelly specific features.
30 *
31 * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
32 * @version $Revision: 155420 $
33 */
34 public class JellyStylesheet extends Stylesheet {
35
36 /*** The Log to which logging calls will be made. */
37 private Log log = LogFactory.getLog(JellyStylesheet.class);
38
39 private XMLOutput output;
40
41 public JellyStylesheet() {
42 setValueOfAction(
43 new Action() {
44 public void run(Node node) throws Exception {
45 String text = node.getStringValue();
46 if ( text != null && text.length() > 0 ) {
47 getOutput().write( text );
48 }
49 }
50 }
51 );
52 }
53
54
55
56
57 /***
58 * Returns the output.
59 * @return XMLOutput
60 */
61 public XMLOutput getOutput() {
62 return output;
63 }
64
65 /***
66 * Sets the output.
67 * @param output The output to set
68 */
69 public void setOutput(XMLOutput output) {
70 this.output = output;
71 }
72
73 }