1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is TransforMiiX XSLT Processor.
16 *
17 * The Initial Developer of the Original Code is
18 * Axel Hecht.
19 * Portions created by the Initial Developer are Copyright (C) 2002
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 * Axel Hecht, <axel@pike.org>
24 *
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
36 *
37 * ***** END LICENSE BLOCK ***** */
38
39 #include "nsISupports.idl"
40 #include "domstubs.idl"
41
42 interface nsIVariant;
43
44 [scriptable, uuid(4a91aeb3-4100-43ee-a21e-9866268757c5)]
45 interface nsIXSLTProcessor : nsISupports
46 {
47 /**
48 * Import the stylesheet into this XSLTProcessor for transformations.
49 *
50 * @param style The root-node of a XSLT stylesheet. This can be either
51 * a document node or an element node. If a document node
52 * then the document can contain either a XSLT stylesheet
53 * or a LRE stylesheet.
54 * If the argument is an element node it must be the
55 * xsl:stylesheet (or xsl:transform) element of an XSLT
56 * stylesheet.
57 *
58 * @exception nsIXSLTException
59 */
60 void importStylesheet(in nsIDOMNode style);
61
62 /**
63 * Transforms the node source applying the stylesheet given by
64 * the importStylesheet() function. The owner document of the output node
65 * owns the returned document fragment.
66 *
67 * @param source The node to be transformed
68 * @param output This document is used to generate the output
69 * @return DocumentFragment The result of the transformation
70 *
71 * @exception nsIXSLTException
72 */
73 nsIDOMDocumentFragment transformToFragment(in nsIDOMNode source,
74 in nsIDOMDocument output);
75
76 /**
77 * Transforms the node source applying the stylesheet given by the
78 * importStylesheet() function.
79 *
80 * @param source The node to be transformed
81 * @return Document The result of the transformation
82 *
83 * @exception nsIXSLTException
84 */
85 nsIDOMDocument transformToDocument(in nsIDOMNode source);
86
87 /**
88 * Sets a parameter to be used in subsequent transformations with this
89 * nsIXSLTProcessor. If the parameter doesn't exist in the stylesheet the
90 * parameter will be ignored.
91 *
92 * @param namespaceURI The namespaceURI of the XSLT parameter
93 * @param localName The local name of the XSLT parameter
94 * @param value The new value of the XSLT parameter
95 *
96 * @exception NS_ERROR_ILLEGAL_VALUE The datatype of value is
97 * not supported
98 */
99 void setParameter(in DOMString namespaceURI,
100 in DOMString localName,
101 in nsIVariant value);
102
103 /**
104 * Gets a parameter if previously set by setParameter. Returns null
105 * otherwise.
106 *
107 * @param namespaceURI The namespaceURI of the XSLT parameter
108 * @param localName The local name of the XSLT parameter
109 * @return nsIVariant The value of the XSLT parameter
110 */
111 nsIVariant getParameter(in DOMString namespaceURI,
112 in DOMString localName);
113 /**
114 * Removes a parameter, if set. This will make the processor use the
115 * default-value for the parameter as specified in the stylesheet.
116 *
117 * @param namespaceURI The namespaceURI of the XSLT parameter
118 * @param localName The local name of the XSLT parameter
119 */
120 void removeParameter(in DOMString namespaceURI,
121 in DOMString localName);
122
123 /**
124 * Removes all set parameters from this nsIXSLTProcessor. This will make
125 * the processor use the default-value for all parameters as specified in
126 * the stylesheet.
127 */
128 void clearParameters();
129
130 /**
131 * Remove all parameters and stylesheets from this nsIXSLTProcessor.
132 */
133 void reset();
134 };