[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ko/docs/Web/API/XSLTProcessor [Back]  [Original]

Using the Mozilla JavaScript interface to XSL Transformations - Web API | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

Using the Mozilla JavaScript interface to XSL Transformations

Deprecated

Avoid using this feature in new projects. XSLT is a candidate for removal from browsers because browser implementations are highly susceptible to memory safety vulnerabilities. This feature may be a candidate for removal from web standards or browsers.

Mozilla 1.2 JavaScript XSLT (TransforMiiX) .

In this article

XSLTProcessor

, XSLTProcessor .

var processor = new XSLTProcessor();

importStylesheet() (import) . XSLT DOM . ( DOM , ) . DOM . .

var testTransform = document.implementation.createDocument("", "test", null);
// just an example to get a transform into a script as a DOM
// XMLDocument.load is asynchronous, so all processing happens in the
// onload handler
testTransform.addEventListener("load", onload, false);
testTransform.load("test-transform.xml");
function onload() {
  processor.importStylesheet(testTransform);
}

importStylesheet DOM . XSL Transform literal result element transform , xsl:stylesheet xsl:transform .

XSLT transformToDocument() transformToFragment() .

transformToDocument

transformToDocument() DOM Document .

var newDocument = processor.transformToDocument(domToBeTransformed);

output html HTMLDocument, xml XMLDocument, text text <transformiix:result> XMLDocument.

transformToFragment

DOM DocumentFragment transformToFragment() . (fragment) (merge) . overhead .

transformToFragment . ( ) ( ) Document .

var ownerDocument = document.implementation.createDocument("", "test", null);
var newFragment = processor.transformToFragment(domToBeTransformed, ownerDocument);

transformToFragment HTMLDocument output HTML HTML DOM . transformToFragment <html> HTML DOM . (override) , output .

setParameter, getParameter, removeParameter parameters for the stylesheet . setParameter URI .

XSLTProcessor (processor) reset() . Mozilla 1.3 .

Specification
DOM
# interface-xsltprocessor


Web Proxy Viewer  |  New URL  |  Original Page