网站首页  汉语字词  英语词汇  考试资料  写作素材  旧版资料

请输入您要查询的考试资料:

 

标题 hta实现的笨狼xslt练习器
内容
    <html>
    <head>
    <title>笨狼xslt练习器 _脚本之家</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(); >开始转换</button>
    <button  onclick = browse(); >预览结果</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()
    {//在文本框内加载xml
        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格式错误!);
        }
    }
    function showxsl()
    {//在文本框内加载xsl
        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格式错误!);
        }
    }
    function validator(instr,outstr)
    {//检查文件格式
        var last=instr.match(/^(.*)(\.)(.{1,8})$/)[3];           
        last=last.touppercase();
        if(last==outstr)
        {    
            return true;
        }
        else
        {        
            return false;
            }
    }    
    function parsexml()
    {//解析
        if(!blockxml.value ||!blockxsl.value)
        {
        return
        }    
            if(!xmldoc.loadxml(blockxml.value))
            {
                alert(xml未加载成功!)
            }
            if(!xsldoc.loadxml(blockxsl.value))
            {
                alert(xsl未加载成功!)
            }
        var s = xmldoc.transformnode(xsldoc);
        showme.value = s;
    }
    </script>
    </body>
    </html>
随便看

 

在线学习网考试资料包含高考、自考、专升本考试、人事考试、公务员考试、大学生村官考试、特岗教师招聘考试、事业单位招聘考试、企业人才招聘、银行招聘、教师招聘、农村信用社招聘、各类资格证书考试等各类考试资料。

 

Copyright © 2002-2024 cuapp.net All Rights Reserved
更新时间:2025/5/13 5:19:36