View Javadoc

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