An HTA implementation of the stupid Wolf XSLT practitioner _hta

Source: Internet
Author: User
Tags xsl xslt

<HTML>
<HEAD>
<TITLE> Stupid Wolf XSLT practitioner _ cloud-dwelling community </TITLE>
<style>
Body
{
Font-size:12;
BACKGROUND: #DADADA;
margin-left:20;
}

#blockXML
{

Font-family:verdana;
font-size:12px;
Overflow:scroll;
height:400;
top:40;
left:20;

}
Input
{
width:350;
}
#blockXSL
{
Position:absolute;
Font-family:verdana;
font-size:12px;
Overflow:scroll;
height:400;
top:40;
}
#showMe
{
Font-family:verdana;
font-size:12px;
height:100;
overflow:visible;
top:300;
left:20;
}

</style>
</HEAD>

<BODY>
<input type= "File" id= "filexml" onchange = "showxml ();" /> XML
<input type= "File" id= "filexsl" onchange = "showxsl ();" /> XSL
<button onclick = "parsexml ();" > Start conversion </button>
<button onclick = "browse ();" > Preview Results </button>
<textarea id= "Blockxml" ></textArea>
<textarea id= "Blockxsl" ></textArea>
<textarea id= "ShowMe" ></textArea>
<script language= "JavaScript" >
Window.resizeto (Window.screen.availwidth,window.screen.availheight);
Window.moveto (0,0);
BlockXML.style.width = parseint (window.screen.availWidth * 0.46);
BlockXSL.style.width = BlockXML.style.width;

BlockXSL.style.left = parseint (Window.screen.availWidth * 0.46) + 30;

ShowMe.style.width = parseint (Window.screen.availWidth * 0.92) + 10;

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

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.