nsIXSLTProcessor 编辑

content/xslt/public/nsIXSLTProcessor.idlScriptable XSLT Processor Inherits from: nsISupports Last changed in Gecko 1.7

Implemented by: @mozilla.org/document-transformer;1?type=xslt. To create an instance, use:

var xsltProcessor = Components.classes["@mozilla.org/document-transformer;1?type=xslt"]
                    .createInstance(Components.interfaces.nsIXSLTProcessor);

Method overview

void clearParameters();
nsIVariant getParameter(in DOMString namespaceURI, in DOMString localName);
void importStylesheet(in nsIDOMNode style);
void removeParameter(in DOMString namespaceURI, in DOMString localName);
void reset();
void setParameter(in DOMString namespaceURI, in DOMString localName, in nsIVariant value);
nsIDOMDocument transformToDocument(in nsIDOMNode source);
nsIDOMDocumentFragment transformToFragment(in nsIDOMNode source, in nsIDOMDocument output);

Methods

clearParameters()

Removes all set parameters from this nsIXSLTProcessor. This will make the processor use the default-value for all parameters as specified in the stylesheet.

void clearParameters();
Parameters

None.

getParameter()

Gets a parameter if previously set by setParameter(). Returns null otherwise.

nsIVariant getParameter(
  in DOMString namespaceURI,
  in DOMString localName
);
Parameters
namespaceURI
The namespaceURI of the XSLT parameter.
localName
The local name of the XSLT parameter.
Return value

An nsIVariant containing the value of the parameter.

importStylesheet()

Imports the specified stylesheet into this XSLTProcessor for transformations.

void importStylesheet(
  in nsIDOMNode style
);
Parameters
style
The root-node of a XSLT stylesheet. This can be either a document node or an element node. If a document node then the document can contain either a XSLT stylesheet or a LRE stylesheet. If the argument is an element node it must be the xsl:stylesheet (or xsl:transform) element of an XSLT stylesheet.

removeParameter()

Removes a parameter, if set. This will make the processor use the default-value for the parameter as specified in the stylesheet.

void removeParameter(
  in DOMString namespaceURI,
  in DOMString localName
);
Parameters
namespaceURI
The namespaceURI of the XSLT parameter.
localName
The local name of the XSLT parameter.

reset()

Remove all parameters and stylesheets from this nsIXSLTProcessor.

void reset();
Parameters

None.

setParameter()

Sets a parameter to be used in subsequent transformations with this nsIXSLTProcessor. If the parameter doesn't exist in the stylesheet the parameter will be ignored.

void setParameter(
  in DOMString namespaceURI,
  in DOMString localName,
  in nsIVariant value
);
Parameters
namespaceURI
The namespaceURI of the XSLT parameter.
localName
The local name of the XSLT parameter.
value
The new value of the XSLT parameter.

transformToDocument()

Transforms the node source applying the stylesheet imported by importStylesheet().

nsIDOMDocument transformToDocument(
  in nsIDOMNode source
);
Parameters
source
The node to be transformed.
Return value

An Document containing the result of the transformation.

transformToFragment()

Transforms the node source applying the stylesheet imported by importStylesheet(). The created fragment will be owned by the specified output document.

nsIDOMDocumentFragment transformToFragment(
  in nsIDOMNode source,
  in nsIDOMDocument output
);
Parameters
source
The node to be transformed.
output
The document to own the returned document fragment.
Return value

A DocumentFragment containing the resulting transform.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:89 次

字数:7992

最后编辑:6年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文