nsIXSLTProcessor 编辑
content/xslt/public/nsIXSLTProcessor.idl
Scriptable XSLT Processor Inherits from: nsISupports
Last changed in Gecko 1.7Implemented 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论