nsIXSLTProcessor.idl 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. #include "domstubs.idl"
  6. interface nsIVariant;
  7. [scriptable, uuid(4a91aeb3-4100-43ee-a21e-9866268757c5)]
  8. interface nsIXSLTProcessor : nsISupports
  9. {
  10. /**
  11. * Import the stylesheet into this XSLTProcessor for transformations.
  12. *
  13. * @param style The root-node of a XSLT stylesheet. This can be either
  14. * a document node or an element node. If a document node
  15. * then the document can contain either a XSLT stylesheet
  16. * or a LRE stylesheet.
  17. * If the argument is an element node it must be the
  18. * xsl:stylesheet (or xsl:transform) element of an XSLT
  19. * stylesheet.
  20. */
  21. void importStylesheet(in nsIDOMNode style);
  22. /**
  23. * Transforms the node source applying the stylesheet given by
  24. * the importStylesheet() function. The owner document of the output node
  25. * owns the returned document fragment.
  26. *
  27. * @param source The node to be transformed
  28. * @param output This document is used to generate the output
  29. * @return DocumentFragment The result of the transformation
  30. */
  31. nsIDOMDocumentFragment transformToFragment(in nsIDOMNode source,
  32. in nsIDOMDocument output);
  33. /**
  34. * Transforms the node source applying the stylesheet given by the
  35. * importStylesheet() function.
  36. *
  37. * @param source The node to be transformed
  38. * @return Document The result of the transformation
  39. */
  40. nsIDOMDocument transformToDocument(in nsIDOMNode source);
  41. /**
  42. * Sets a parameter to be used in subsequent transformations with this
  43. * nsIXSLTProcessor. If the parameter doesn't exist in the stylesheet the
  44. * parameter will be ignored.
  45. *
  46. * @param namespaceURI The namespaceURI of the XSLT parameter
  47. * @param localName The local name of the XSLT parameter
  48. * @param value The new value of the XSLT parameter
  49. *
  50. * @exception NS_ERROR_ILLEGAL_VALUE The datatype of value is
  51. * not supported
  52. */
  53. void setParameter(in DOMString namespaceURI,
  54. in DOMString localName,
  55. in nsIVariant value);
  56. /**
  57. * Gets a parameter if previously set by setParameter. Returns null
  58. * otherwise.
  59. *
  60. * @param namespaceURI The namespaceURI of the XSLT parameter
  61. * @param localName The local name of the XSLT parameter
  62. * @return nsIVariant The value of the XSLT parameter
  63. */
  64. nsIVariant getParameter(in DOMString namespaceURI,
  65. in DOMString localName);
  66. /**
  67. * Removes a parameter, if set. This will make the processor use the
  68. * default-value for the parameter as specified in the stylesheet.
  69. *
  70. * @param namespaceURI The namespaceURI of the XSLT parameter
  71. * @param localName The local name of the XSLT parameter
  72. */
  73. void removeParameter(in DOMString namespaceURI,
  74. in DOMString localName);
  75. /**
  76. * Removes all set parameters from this nsIXSLTProcessor. This will make
  77. * the processor use the default-value for all parameters as specified in
  78. * the stylesheet.
  79. */
  80. void clearParameters();
  81. /**
  82. * Remove all parameters and stylesheets from this nsIXSLTProcessor.
  83. */
  84. void reset();
  85. };