XSLTProcessor.webidl (4230B)
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 typedef (unrestricted double or boolean or DOMString or Node or sequence<Node> or XPathResult) XSLTParameterValue; 7 8 [Exposed=Window] 9 interface XSLTProcessor { 10 [UseCounter] 11 constructor(); 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 [Throws] 25 undefined importStylesheet(Node style); 26 27 /** 28 * Transforms the node source applying the stylesheet given by 29 * the importStylesheet() function. The owner document of the output node 30 * owns the returned document fragment. 31 * 32 * @param source The node to be transformed 33 * @param output This document is used to generate the output 34 * @return DocumentFragment The result of the transformation 35 */ 36 [CEReactions, Throws] 37 DocumentFragment transformToFragment(Node source, 38 Document output); 39 40 /** 41 * Transforms the node source applying the stylesheet given by the 42 * importStylesheet() function. 43 * 44 * @param source The node to be transformed 45 * @return Document The result of the transformation 46 */ 47 [CEReactions, Throws] 48 Document transformToDocument(Node source); 49 50 /** 51 * Sets a parameter to be used in subsequent transformations with this 52 * XSLTProcessor. If the parameter doesn't exist in the stylesheet the 53 * parameter will be ignored. 54 * 55 * @param namespaceURI The namespaceURI of the XSLT parameter 56 * @param localName The local name of the XSLT parameter 57 * @param value The new value of the XSLT parameter 58 */ 59 [Throws] 60 undefined setParameter([LegacyNullToEmptyString] DOMString namespaceURI, 61 DOMString localName, 62 XSLTParameterValue value); 63 64 /** 65 * Gets a parameter if previously set by setParameter. Returns null 66 * otherwise. 67 * 68 * @param namespaceURI The namespaceURI of the XSLT parameter 69 * @param localName The local name of the XSLT parameter 70 * @return ParameterValue The value of the XSLT parameter 71 */ 72 [Throws] 73 XSLTParameterValue? getParameter([LegacyNullToEmptyString] DOMString namespaceURI, 74 DOMString localName); 75 /** 76 * Removes a parameter, if set. This will make the processor use the 77 * default-value for the parameter as specified in the stylesheet. 78 * 79 * @param namespaceURI The namespaceURI of the XSLT parameter 80 * @param localName The local name of the XSLT parameter 81 */ 82 [Throws] 83 undefined removeParameter([LegacyNullToEmptyString] DOMString namespaceURI, 84 DOMString localName); 85 86 /** 87 * Removes all set parameters from this XSLTProcessor. This will make 88 * the processor use the default-value for all parameters as specified in 89 * the stylesheet. 90 */ 91 [Throws] 92 undefined clearParameters(); 93 94 /** 95 * Remove all parameters and stylesheets from this XSLTProcessor. 96 */ 97 [Throws] 98 undefined reset(); 99 100 /** 101 * Disables all loading of external documents, such as from 102 * <xsl:import> and document() 103 * Defaults to off and is *not* reset by calls to reset() 104 */ 105 [ChromeOnly] 106 const unsigned long DISABLE_ALL_LOADS = 1; 107 108 /** 109 * Flags for this processor. Defaults to 0. See individual flags above 110 * for documentation for effect of reset() 111 */ 112 [ChromeOnly, NeedsCallerType] 113 attribute unsigned long flags; 114 };