|
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #include "domstubs.idl" |
|
7 |
|
8 interface nsIVariant; |
|
9 |
|
10 [scriptable, uuid(4a91aeb3-4100-43ee-a21e-9866268757c5)] |
|
11 interface nsIXSLTProcessor : nsISupports |
|
12 { |
|
13 /** |
|
14 * Import the stylesheet into this XSLTProcessor for transformations. |
|
15 * |
|
16 * @param style The root-node of a XSLT stylesheet. This can be either |
|
17 * a document node or an element node. If a document node |
|
18 * then the document can contain either a XSLT stylesheet |
|
19 * or a LRE stylesheet. |
|
20 * If the argument is an element node it must be the |
|
21 * xsl:stylesheet (or xsl:transform) element of an XSLT |
|
22 * stylesheet. |
|
23 * |
|
24 * @exception nsIXSLTException |
|
25 */ |
|
26 void importStylesheet(in nsIDOMNode style); |
|
27 |
|
28 /** |
|
29 * Transforms the node source applying the stylesheet given by |
|
30 * the importStylesheet() function. The owner document of the output node |
|
31 * owns the returned document fragment. |
|
32 * |
|
33 * @param source The node to be transformed |
|
34 * @param output This document is used to generate the output |
|
35 * @return DocumentFragment The result of the transformation |
|
36 * |
|
37 * @exception nsIXSLTException |
|
38 */ |
|
39 nsIDOMDocumentFragment transformToFragment(in nsIDOMNode source, |
|
40 in nsIDOMDocument output); |
|
41 |
|
42 /** |
|
43 * Transforms the node source applying the stylesheet given by the |
|
44 * importStylesheet() function. |
|
45 * |
|
46 * @param source The node to be transformed |
|
47 * @return Document The result of the transformation |
|
48 * |
|
49 * @exception nsIXSLTException |
|
50 */ |
|
51 nsIDOMDocument transformToDocument(in nsIDOMNode source); |
|
52 |
|
53 /** |
|
54 * Sets a parameter to be used in subsequent transformations with this |
|
55 * nsIXSLTProcessor. If the parameter doesn't exist in the stylesheet the |
|
56 * parameter will be ignored. |
|
57 * |
|
58 * @param namespaceURI The namespaceURI of the XSLT parameter |
|
59 * @param localName The local name of the XSLT parameter |
|
60 * @param value The new value of the XSLT parameter |
|
61 * |
|
62 * @exception NS_ERROR_ILLEGAL_VALUE The datatype of value is |
|
63 * not supported |
|
64 */ |
|
65 void setParameter(in DOMString namespaceURI, |
|
66 in DOMString localName, |
|
67 in nsIVariant value); |
|
68 |
|
69 /** |
|
70 * Gets a parameter if previously set by setParameter. Returns null |
|
71 * otherwise. |
|
72 * |
|
73 * @param namespaceURI The namespaceURI of the XSLT parameter |
|
74 * @param localName The local name of the XSLT parameter |
|
75 * @return nsIVariant The value of the XSLT parameter |
|
76 */ |
|
77 nsIVariant getParameter(in DOMString namespaceURI, |
|
78 in DOMString localName); |
|
79 /** |
|
80 * Removes a parameter, if set. This will make the processor use the |
|
81 * default-value for the parameter as specified in the stylesheet. |
|
82 * |
|
83 * @param namespaceURI The namespaceURI of the XSLT parameter |
|
84 * @param localName The local name of the XSLT parameter |
|
85 */ |
|
86 void removeParameter(in DOMString namespaceURI, |
|
87 in DOMString localName); |
|
88 |
|
89 /** |
|
90 * Removes all set parameters from this nsIXSLTProcessor. This will make |
|
91 * the processor use the default-value for all parameters as specified in |
|
92 * the stylesheet. |
|
93 */ |
|
94 void clearParameters(); |
|
95 |
|
96 /** |
|
97 * Remove all parameters and stylesheets from this nsIXSLTProcessor. |
|
98 */ |
|
99 void reset(); |
|
100 }; |