TV Guide


TV Guide
function displayTransformedXML() {
// Create Document objects
var xmlDOM = createDocumentObject();
var xslDOM = createDocumentObject();
// Load XML and stylesheet documents
xmlDOM.load('TVGuide.xml');
xslDOM.load('TVGuide.xsl');
// Check for parse errors
if (xmlDOM.parseError.errorCode != 0) {
reportParseError(xmlDOM.parseError);
return;
}
if (xslDOM.parseError.errorCode != 0) {
reportParseError(xslDOM.parseError);
return;
}
try {
// Create Template object
xslTemplate = new ActiveXObject('MSXML2.XSLTemplate');
// Compile the stylesheet into the Template object
xslTemplate.stylesheet = xslDOM;
// Create a Processor object
var xslProcessor = xslTemplate.createProcessor();
// Set the processor input
xslProcessor.input = xmlDOM;
// Run the transformation
xslProcessor.transform();
document.write(xslProcessor.output);
}
catch (exception) {
alert(exception.description);
}
}
function createDocumentObject() {
var DOM = new ActiveXObject('MSXML2.FreeThreadedDOMDocument.4.0');
DOM.async = false;
DOM.validateOnParse = false;
DOM.preserveWhiteSpace = true;
return DOM;
}
function reportParseError( error ) {
alert('Error parsing ' + error.url +
' at ' + error.line + ':' + error.linepos +
':\n' + error.reason);
return;
}
содержание | 2 | Интернет Пиар
Используются технологии uCoz