1 package org.apache.turbine.services.xslt;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import java.io.Reader;
20 import java.io.Writer;
21 import java.util.Map;
22
23 import org.apache.turbine.services.Service;
24 import org.w3c.dom.Node;
25
26 /***
27 * The Turbine XSLT Service is used to transform xml with a xsl stylesheet.
28 * The service makes use of the Xalan xslt engine available from apache.
29 *
30 * @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a>
31 * @author <a href="thomas.vandahl@tewisoft.de">Thomas Vandahl</a>
32 * @version $Id: XSLTService.java 264148 2005-08-29 14:21:04Z henning $
33 */
34 public interface XSLTService
35 extends Service
36 {
37 /*** Service name */
38 String SERVICE_NAME = "XSLTService";
39
40 /*** Name of the Style sheet path property */
41 String STYLESHEET_PATH = "path";
42
43 /*** Default value of the Style sheet path */
44 String STYLESHEET_PATH_DEFAULT = "/";
45
46 /*** Property for caching the stylesheets */
47 String STYLESHEET_CACHING = "cache";
48
49 /*** Default for caching the stylesheets */
50 boolean STYLESHEET_CACHING_DEFAULT = false;
51
52 /***
53 * Uses an xsl file to transform xml input from a reader and writes the
54 * output to a writer.
55 *
56 * @param xslName The name of the file that contains the xsl stylesheet.
57 * @param in The reader that passes the xml to be transformed
58 * @param out The writer for the transformed output
59 */
60 void transform(String xslName, Reader in, Writer out) throws Exception;
61
62 /***
63 * Uses an xsl file to transform xml input from a reader and returns a
64 * string containing the transformed output.
65 *
66 * @param xslName The name of the file that contains the xsl stylesheet.
67 * @param in The reader that passes the xml to be transformed
68 */
69 String transform(String xslName, Reader in) throws Exception;
70
71 /***
72 * Uses an xsl file to transform xml input from a DOM note and writes the
73 * output to a writer.
74 *
75 * @param xslName The name of the file that contains the xsl stylesheet.
76 * @param in The DOM Node to be transformed
77 * @param out The writer for the transformed output
78 */
79 void transform(String xslName, Node in, Writer out) throws Exception;
80
81 /***
82 * Uses an xsl file to transform xml input from a DOM note and returns a
83 * string containing the transformed output.
84 *
85 * @param xslName The name of the file that contains the xsl stylesheet.
86 * @param out The writer for the transformed output
87 */
88 String transform(String xslName, Node in) throws Exception;
89
90 /***
91 * Uses an xsl file to transform xml input from a reader and writes the
92 * output to a writer.
93 *
94 * @param xslName The name of the file that contains the xsl stylesheet.
95 * @param in The reader that passes the xml to be transformed
96 * @param out The writer for the transformed output
97 * @param params A set of parameters that will be forwarded to the XSLT
98 */
99 void transform(String xslName, Reader in, Writer out, Map params) throws Exception;
100
101 /***
102 * Uses an xsl file to transform xml input from a reader and returns a
103 * string containing the transformed output.
104 *
105 * @param xslName The name of the file that contains the xsl stylesheet.
106 * @param in The reader that passes the xml to be transformed
107 * @param params A set of parameters that will be forwarded to the XSLT
108 */
109 String transform(String xslName, Reader in, Map params) throws Exception;
110
111 /***
112 * Uses an xsl file to transform xml input from a DOM note and writes the
113 * output to a writer.
114 *
115 * @param xslName The name of the file that contains the xsl stylesheet.
116 * @param in The DOM Node to be transformed
117 * @param out The writer for the transformed output
118 * @param params A set of parameters that will be forwarded to the XSLT
119 */
120 void transform(String xslName, Node in, Writer out, Map params) throws Exception;
121
122 /***
123 * Uses an xsl file to transform xml input from a DOM note and returns a
124 * string containing the transformed output.
125 *
126 * @param xslName The name of the file that contains the xsl stylesheet.
127 * @param out The writer for the transformed output
128 * @param params A set of parameters that will be forwarded to the XSLT
129 */
130 String transform(String xslName, Node in, Map params) throws Exception;
131 }