View Javadoc

1   package org.apache.turbine.services.xslt;
2   
3   /*
4    * Copyright 2001-2004 The Apache Software Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License")
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  import java.io.Reader;
20  import java.io.Writer;
21  
22  import org.apache.turbine.services.Service;
23  
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   * @version $Id: XSLTService.java,v 1.5.2.2 2004/05/20 03:06:52 seade Exp $
32   */
33  public interface XSLTService
34          extends Service
35  {
36      /*** Service name */
37      String SERVICE_NAME = "XSLTService";
38  
39      /*** Name of the Style sheet path property */
40      String STYLESHEET_PATH = "path";
41  
42      /*** Property for caching the stylesheets */
43      String STYLESHEET_CACHING = "cache";
44  
45      /***
46       * Uses an xsl file to transform xml input from a reader and writes the
47       * output to a writer.
48       *
49       * @param xslName The name of the file that contains the xsl stylesheet.
50       * @param in The reader that passes the xml to be transformed
51       * @param out The writer for the transformed output
52       */
53      void transform(String xslName, Reader in, Writer out) throws Exception;
54  
55      /***
56       * Uses an xsl file to transform xml input from a reader and returns a
57       * string containing the transformed output.
58       *
59       * @param xslName The name of the file that contains the xsl stylesheet.
60       * @param in The reader that passes the xml to be transformed
61       */
62      String transform(String xslName, Reader in) throws Exception;
63  
64      /***
65       * Uses an xsl file to transform xml input from a DOM note and writes the
66       * output to a writer.
67       *
68       * @param xslName The name of the file that contains the xsl stylesheet.
69       * @param in The DOM Node to be transformed
70       * @param out The writer for the transformed output
71       */
72      void transform(String xslName, Node in, Writer out) throws Exception;
73  
74      /***
75       * Uses an xsl file to transform xml input from a DOM note and returns a
76       * string containing the transformed output.
77       *
78       * @param xslName The name of the file that contains the xsl stylesheet.
79       * @param out The writer for the transformed output
80       */
81      String transform(String xslName, Node in) throws Exception;
82  }