Bug 1634779 - pt 2. Partially revert Bug 1603006 r=kmag
[gecko.git] / dom / webidl / XSLTProcessor.webidl
blob8334ef08ebd9b8b4ceaa0894c11a325ce29f2ef5
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/. */
6 interface nsIVariant;
8 [Exposed=Window]
9 interface XSLTProcessor {
10     constructor();
12     /**
13      * Import the stylesheet into this XSLTProcessor for transformations.
14      *
15      * @param style The root-node of a XSLT stylesheet. This can be either
16      *              a document node or an element node. If a document node
17      *              then the document can contain either a XSLT stylesheet
18      *              or a LRE stylesheet.
19      *              If the argument is an element node it must be the
20      *              xsl:stylesheet (or xsl:transform) element of an XSLT
21      *              stylesheet.
22      */
23     [Throws]
24     void importStylesheet(Node style);
26     /**
27      * Transforms the node source applying the stylesheet given by
28      * the importStylesheet() function. The owner document of the output node
29      * owns the returned document fragment.
30      *
31      * @param source The node to be transformed
32      * @param output This document is used to generate the output
33      * @return DocumentFragment The result of the transformation
34      */
35     [CEReactions, Throws]
36     DocumentFragment transformToFragment(Node source,
37                                          Document output);
39     /**
40      * Transforms the node source applying the stylesheet given by the
41      * importStylesheet() function.
42      *
43      * @param source The node to be transformed
44      * @return Document The result of the transformation
45      */
46     [CEReactions, Throws]
47     Document transformToDocument(Node source);
49     /**
50      * Sets a parameter to be used in subsequent transformations with this
51      * XSLTProcessor. If the parameter doesn't exist in the stylesheet the
52      * parameter will be ignored.
53      *
54      * @param namespaceURI The namespaceURI of the XSLT parameter
55      * @param localName    The local name of the XSLT parameter
56      * @param value        The new value of the XSLT parameter
57      */
58     [Throws]
59     void setParameter([TreatNullAs=EmptyString] DOMString namespaceURI,
60                       DOMString localName,
61                       any value);
63     /**
64      * Gets a parameter if previously set by setParameter. Returns null
65      * otherwise.
66      *
67      * @param namespaceURI The namespaceURI of the XSLT parameter
68      * @param localName    The local name of the XSLT parameter
69      * @return nsIVariant  The value of the XSLT parameter
70      */
71     [Throws]
72     nsIVariant? getParameter([TreatNullAs=EmptyString] DOMString namespaceURI,
73                              DOMString localName);
74     /**
75      * Removes a parameter, if set. This will make the processor use the
76      * default-value for the parameter as specified in the stylesheet.
77      *
78      * @param namespaceURI The namespaceURI of the XSLT parameter
79      * @param localName    The local name of the XSLT parameter
80      */
81     [Throws]
82     void removeParameter([TreatNullAs=EmptyString] DOMString namespaceURI,
83                          DOMString localName);
85     /**
86      * Removes all set parameters from this XSLTProcessor. This will make
87      * the processor use the default-value for all parameters as specified in
88      * the stylesheet.
89      */
90     void clearParameters();
92     /**
93      * Remove all parameters and stylesheets from this XSLTProcessor.
94      */
95     void reset();
97     /**
98     * Disables all loading of external documents, such as from
99     * <xsl:import> and document()
100     * Defaults to off and is *not* reset by calls to reset()
101     */
102     [ChromeOnly]
103     const unsigned long DISABLE_ALL_LOADS = 1;
105     /**
106     * Flags for this processor. Defaults to 0. See individual flags above
107     * for documentation for effect of reset()
108     */
109     [ChromeOnly, NeedsCallerType]
110     attribute unsigned long flags;