1 package net.sf.tomp.xtcl.command;
2
3 import net.sf.tomp.xtcl.Context;
4 import net.sf.tomp.xtcl.filter.XTFilterFactory;
5
6 import org.xml.sax.XMLFilter;
7
8 import javax.xml.transform.Templates;
9 import javax.xml.transform.TransformerConfigurationException;
10 import javax.xml.transform.TransformerFactory;
11 import javax.xml.transform.stream.StreamSource;
12
13 /***
14 * Filter based on STX transformation.
15 *
16 * @author tomp
17 */
18 public class STXFilterCommand extends StyleFilterCommand {
19
20 /***
21 * Gets the necesssary factories and creates the transformation
22 * filter based on the STX (Joost) style.
23 *
24 * @see net.sf.tomp.xtcl.command.StyleFilterCommand#makeFilter(net.sf.tomp.xtcl.Context, java.lang.String)
25 */
26 protected XMLFilter makeFilter(Context context, String styleRef)
27 throws TransformerConfigurationException {
28
29 TransformerFactory tf = context.getJoostTransformerFactory();
30 XTFilterFactory factory = context.getXTFilterFactory();
31
32 Templates templates = styleRef.startsWith("$") ? context
33 .refToJoostStyle(styleRef) : tf.newTemplates(new StreamSource(
34 context.getFile(styleRef)));
35
36 return factory.newJoostFilter(templates);
37 }
38
39 /***
40 * @return "JOOST FILTER " + super.toString();
41 */
42 public String toString() {
43 return "JOOST FILTER " + super.toString();
44 }
45 }
46
47
48
49
50
51
52
53
54
55
56