var FSO
FSO = new ActiveXObject ("Scripting.FileSystemObject");
var xmldoc, Xsldoc;
xmldoc = new ActiveXObject ("MSXML2. DOMDocument ");
Xsldoc = new ActiveXObject ("MSXML2. DOMDocument ");
Xmldoc.async = false;
Xsldoc.async = false;
function browse ()
{
var win=window.open ();
Win.document.write (Showme.value);
}
function Showxml ()
{//Load XML in text box
if (Validator (Filexml.value, "XML"))
{
if (FSO). FileExists (Filexml.value))
{
var f = fso. GetFile (Filexml.value);
var ts = f.openastextstream (1,-2);
var s= "";
if (!ts. AtEndOfStream)
{
s = ts. ReadAll ();
}
Ts. Close ();
Blockxml.value = s;
Filexml.value = "";
}
}
Else
{
Alert ("XML format error!) ");
}
}
function showxsl ()
{//Load XSL inside text box
if (Validator (Filexsl.value, "XSL") | | Validator (Filexsl.value, "XSLT")
{
if (FSO). FileExists (Filexsl.value))
{
var f = fso. GetFile (Filexsl.value);
var ts = f.openastextstream (1,-2);
var s= "";
if (!ts. AtEndOfStream)
{
s = ts. ReadAll ();
}
Ts. Close ();
Blockxsl.value = s;
Filexsl.value = "";
}
}
Else
{
Alert ("XSL/XSLT format Error!") ");
}
}
function Validator (INSTR,OUTSTR)
{//Check file format
var last=instr.match (/^ (. *) (\.) (. {1,8}) $/) [3];
Last=last.touppercase ();
if (LAST==OUTSTR)
{
return true;
}
Else
{
return false;
}
}
function Parsexml ()
{//Parse
if (!blockxml.value | |! Blockxsl.value)
{
Return
}
if (!xmldoc.loadxml (Blockxml.value))
{
Alert ("XML is not loaded successfully!) ")
}
if (!xsldoc.loadxml (Blockxsl.value))
{
Alert ("XSL did not load successfully!") ")
}
var s = xmldoc.transformnode (Xsldoc);
Showme.value = s;
}
</SCRIPT>
</BODY>
</HTML>
Stupid Wolf XSLT practice device. HTA
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.