Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
XSLTService |
|
| 1.0;1 |
1 | package org.apache.fulcrum.xslt; | |
2 | ||
3 | /* | |
4 | * Licensed to the Apache Software Foundation (ASF) under one | |
5 | * or more contributor license agreements. See the NOTICE file | |
6 | * distributed with this work for additional information | |
7 | * regarding copyright ownership. The ASF licenses this file | |
8 | * to you under the Apache License, Version 2.0 (the | |
9 | * "License"); you may not use this file except in compliance | |
10 | * with the License. You may obtain a copy of the License at | |
11 | * | |
12 | * http://www.apache.org/licenses/LICENSE-2.0 | |
13 | * | |
14 | * Unless required by applicable law or agreed to in writing, | |
15 | * software distributed under the License is distributed on an | |
16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
17 | * KIND, either express or implied. See the License for the | |
18 | * specific language governing permissions and limitations | |
19 | * under the License. | |
20 | */ | |
21 | ||
22 | import java.io.Reader; | |
23 | import java.io.Writer; | |
24 | import java.util.Map; | |
25 | ||
26 | import org.w3c.dom.Node; | |
27 | ||
28 | /** | |
29 | * The Turbine XSLT Service is used to transform xml with a xsl stylesheet. | |
30 | * The service makes use of the Xalan xslt engine available from apache. | |
31 | * | |
32 | * | |
33 | * @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a> | |
34 | * @author <a href="mailto:tv@apache.org">Thomas Vandahl</a> | |
35 | */ | |
36 | public interface XSLTService | |
37 | { | |
38 | String ROLE = XSLTService.class.getName(); | |
39 | ||
40 | /** | |
41 | * Uses an xsl file to transform xml input from a reader and writes the | |
42 | * output to a writer. | |
43 | * | |
44 | * @param xslName The name of the file that contains the xsl stylesheet. | |
45 | * @param in The reader that passes the xml to be transformed | |
46 | * @param out The writer for the transformed output | |
47 | * @throws Exception the transformation failed | |
48 | */ | |
49 | void transform (String xslName, Reader in, Writer out) throws Exception; | |
50 | ||
51 | /** | |
52 | * Uses an xsl file to transform xml input from a reader and returns a | |
53 | * string containing the transformed output. | |
54 | * | |
55 | * @param xslName The name of the file that contains the xsl stylesheet. | |
56 | * @param in The reader that passes the xml to be transformed | |
57 | * @return the transformed output | |
58 | * @throws Exception the transformation failed | |
59 | */ | |
60 | String transform (String xslName, Reader in) throws Exception; | |
61 | ||
62 | /** | |
63 | * Uses an xsl file to transform xml input from a DOM note and writes the | |
64 | * output to a writer. | |
65 | * | |
66 | * @param xslName The name of the file that contains the xsl stylesheet. | |
67 | * @param in The DOM Node to be transformed | |
68 | * @param out The writer for the transformed output | |
69 | * @throws Exception the transformation failed | |
70 | */ | |
71 | void transform (String xslName, Node in, Writer out) throws Exception; | |
72 | ||
73 | /** | |
74 | * Uses an xsl file to transform xml input from a DOM note and returns a | |
75 | * string containing the transformed output. | |
76 | * | |
77 | * @param xslName The name of the file that contains the xsl stylesheet. | |
78 | * @param in The DOM Node to be transformed | |
79 | * @return the transformed output | |
80 | * @throws Exception the transformation failed | |
81 | */ | |
82 | String transform (String xslName, Node in) throws Exception; | |
83 | ||
84 | /** | |
85 | * Uses an xsl file to transform xml input from a reader and writes the | |
86 | * output to a writer. | |
87 | * | |
88 | * @param xslName The name of the file that contains the xsl stylesheet. | |
89 | * @param in The reader that passes the xml to be transformed | |
90 | * @param out The writer for the transformed output | |
91 | * @param params A set of parameters that will be forwarded to the XSLT | |
92 | * @throws Exception the transformation failed | |
93 | */ | |
94 | void transform(String xslName, Reader in, Writer out, Map<?, ?> params) throws Exception; | |
95 | ||
96 | /** | |
97 | * Uses an xsl file to transform xml input from a reader and returns a | |
98 | * string containing the transformed output. | |
99 | * | |
100 | * @param xslName The name of the file that contains the xsl stylesheet. | |
101 | * @param in The reader that passes the xml to be transformed | |
102 | * @param params A set of parameters that will be forwarded to the XSLT | |
103 | * @return the transformed output | |
104 | * @throws Exception the transformation failed | |
105 | */ | |
106 | String transform(String xslName, Reader in, Map<?, ?> params) throws Exception; | |
107 | ||
108 | /** | |
109 | * Uses an xsl file to transform xml input from a DOM note and writes the | |
110 | * output to a writer. | |
111 | * | |
112 | * @param xslName The name of the file that contains the xsl stylesheet. | |
113 | * @param in The DOM Node to be transformed | |
114 | * @param out The writer for the transformed output | |
115 | * @param params A set of parameters that will be forwarded to the XSLT | |
116 | * @throws Exception the transformation failed | |
117 | */ | |
118 | void transform(String xslName, Node in, Writer out, Map<?, ?> params) throws Exception; | |
119 | ||
120 | /** | |
121 | * Uses an xsl file to transform xml input from a DOM note and returns a | |
122 | * string containing the transformed output. | |
123 | * | |
124 | * @param xslName The name of the file that contains the xsl stylesheet. | |
125 | * @param in The DOM Node to be transformed | |
126 | * @param params A set of parameters that will be forwarded to the XSLT | |
127 | * @return the transformed output | |
128 | * @throws Exception the transformation failed | |
129 | */ | |
130 | String transform(String xslName, Node in, Map<?, ?> params) throws Exception; | |
131 | ||
132 | /** | |
133 | * Uses an xsl file without any xml input. | |
134 | * | |
135 | * @param xslName The name of the file that contains the xsl stylesheet. | |
136 | * @param params A set of parameters that will be forwarded to the XSLT | |
137 | * @return the transformed output | |
138 | * @throws Exception the transformation failed | |
139 | */ | |
140 | String transform(String xslName, Map<?, ?> params) throws Exception; | |
141 | ||
142 | /** | |
143 | * Uses an xsl file without any xml input. | |
144 | * | |
145 | * @param xslName The name of the file that contains the xsl stylesheet | |
146 | * @param out The writer for the transformed output. | |
147 | * @param params A set of parameters that will be forwarded to the XSLT | |
148 | * @throws Exception the transformation failed | |
149 | */ | |
150 | void transform(String xslName, Writer out, Map<?, ?> params) throws Exception; | |
151 | ||
152 | } |