Click here to Skip to main content
15,885,435 members
Home / Discussions / Web Development
   

Web Development

 
QuestionRe: programing the whole site using html 5 or html4?? Pin
Richard MacCutchan14-Nov-13 2:42
mveRichard MacCutchan14-Nov-13 2:42 
AnswerRe: programing the whole site using html 5 or html4?? Pin
TheSniper10514-Nov-13 2:49
professionalTheSniper10514-Nov-13 2:49 
GeneralRe: programing the whole site using html 5 or html4?? Pin
Richard MacCutchan14-Nov-13 2:55
mveRichard MacCutchan14-Nov-13 2:55 
AnswerRe: programing the whole site using html 5 or html4?? Pin
Richard Deeming14-Nov-13 4:32
mveRichard Deeming14-Nov-13 4:32 
QuestionProject deployment to QA server Pin
vkEE13-Nov-13 4:25
vkEE13-Nov-13 4:25 
AnswerRe: Project deployment to QA server Pin
Richard Deeming13-Nov-13 4:54
mveRichard Deeming13-Nov-13 4:54 
QuestionI want do some DataMapping, is there any Best Practice? Pin
aptx159611-Nov-13 23:34
aptx159611-Nov-13 23:34 
AnswerRe: I want do some DataMapping, is there any Best Practice? Pin
aptx159611-Nov-13 23:51
aptx159611-Nov-13 23:51 
I Do Has Some Work been Done.
I've try the HTML-DOM,JSON-Parse. The performance is Very Slow(100 RepeatData in 4 Sec).

Then I've Try the XML-Xslt Translate in client Side.
But I can't Use the Content in side a HTML File.
Is There Any Idea,Can Make Html content like bolow,
translate to a xsl object.



ASP.NET
<head runat="server">
    <title>TEST</title>
    <style type="text/css">
        .style1
        {
            width: 800px;
            border-collapse: collapse;
        }
        .style2
        {
            width: 337px;
        }
    </style>
    
    <script type="text/javascript">
        function loadXMLDoc(dname) {
            if (window.ActiveXObject) {
                xhttp = new ActiveXObject("Msxml2.XMLHTTP.3.0");
            }
            else {
                xhttp = new XMLHttpRequest();
            }
            xhttp.open("GET", dname, false);
            xhttp.send("");
            return xhttp.responseText;
        }

        function StringtoXML(text) {
            if (window.ActiveXObject) {
                var doc = new ActiveXObject('Microsoft.XMLDOM');
                doc.async = 'false';
                doc.loadXML(text);
            } else {
                var parser = new DOMParser();
                var doc = parser.parseFromString(text, 'text/xml');
            }
            return doc;
        }
        function Write(input1) {
            var fso = new ActiveXObject("Scripting.FileSystemObject");
            var s = fso.CreateTextFile("C:\\test.txt", true);
            s.WriteLine(input1);
            s.Close();
        }
        
        
        


        function displayResult() {
            xmlH = loadXMLDoc("DataProvider.aspx");
            xml = StringtoXML(xmlH);
            el = document.getElementById("form1");
            el.removeChild(document.getElementsByTagName("div")[0]);
            xslH = document.getElementById("form1").innerHTML.toLowerCase();
            //debugger;
            alert($("#form1").html());
            var el = (document.getElementById("form1"));
            //xslH = getRightInnerHTML(document.getElementById("form1"));
            xslH = "<?xml version=\"1.0\"?>\n<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\n<xsl:template match=\"NewDataSet\">\n" + xslH;
            xslH += "\n</xsl:template>\n</xsl:stylesheet>"
            xslH = xslH.replace(/XSL/ig, "xsl")
                       .replace(/VALUE-OF/ig, "value-of")
                       .replace(/FOR-EACH/ig, "for-each")
                       .replace(/newdataset/ig, "NewDataSet");
            xsl = StringtoXML(xslH);
            
            // code for IE
            if (window.ActiveXObject) {
                ex = xml.transformNode(xsl);
                document.getElementsByTagName("form").innerHTML = ex;
                
            }
            // code for Mozilla, Firefox, Opera, etc.
            else if (document.implementation && document.implementation.createDocument) {
                xsltProcessor = new XSLTProcessor();
                xsltProcessor.importStylesheet(xsl);
                resultDocument = xsltProcessor.transformToFragment(xml, document);
                document.getElementById("example").appendChild(resultDocument);
            }
        }
        function getRightInnerHTML(elm) {
            var content = elm.innerHTML;
            if (!document.all) return content;
            var regOne = /(\s+\w+)\s*=\s*([^<>"\s]+)(?=[^<>]*\/>)/ig; var regTwo = /"'([^'"]*)'"/ig;
            content = content.replace(regOne, '$1="$2"').replace(regTwo, '\"$1\"');
            var okText = content.replace(/<(\/?)(\w+)([^>]*)>/g, function(match, $1, $2, $3) {
                if ($1) { return "</" + $2.toLowerCase() + ">"; }
                return ("<" + $2.toLowerCase() + $3 + ">").replace(/=(("[^"]*?")|('[^']*?')|([\w\-\.]+))([\s>])/g,
                                function(match2, $1, $2, $3, $4, $5, position, all) {
                                    if ($4) {
                                        return '="' + $4 + '"' + $5;
                                    } return match2;
                                });
                            });
                            okText = okText.replace(/<\/?([^>]+)>/g, function(lele) { return lele; })
                            return okText.replace(/VALUE-OF/ig,"value-of"); } 
    </script>
</head>
<body onload="displayResult();">
    <form id="form1" runat="server">
    <div>
      
        <table cellpadding="0">
            <tr>
                <td>
                    傳票編號</td>
                <td>
                    傳票日期</td>
            </tr>
            <tr>
                <td>
                    <xsl:value-of select="帳款模組/帳款編號" /></td>
                <td>
                    <xsl:value-of select="帳款模組/填寫日期" /></td>
            </tr>
        </table>
        <table cellpadding="0" class="style1">
        <tbody>
        <xsl:for-each select="帳款模組明細">
        <tr>
            <td><xsl:value-of select="主目" /></td>
            <td><xsl:value-of select="子目" /></td>
            <td><xsl:value-of select="科目名稱" /></td>
            <td><xsl:value-of select="摘要" /></td>
            <td><xsl:value-of select="借方金額" /></td>
            <td><xsl:value-of select="貸方金額" /></td>
            <td><xsl:value-of select="部門編號" /></td>
            <td><xsl:value-of select="部門名稱" /></td>
            <td><xsl:value-of select="廠商物件類別" /></td>
            <td><xsl:value-of select="廠商編號" /></td>
            <td><xsl:value-of select="廠商名稱" /></td>
            <td><xsl:value-of select="工程案號" /></td>
            <td><xsl:value-of select="外部物件主編號" /></td>
            <td><xsl:value-of select="外部物件子編號" /></td>
            
        </tr>
        
        
        </xsl:for-each>
        
        </tbody>        
        </table>
    
    </div>
    
    </form>
    <div id="example"></div>
</body>
</html>

Questionwhy I am not getting the value on remote Pin
Jassim Rahma11-Nov-13 11:09
Jassim Rahma11-Nov-13 11:09 
Questionbanner management for ad rotation Pin
Jassim Rahma9-Nov-13 23:04
Jassim Rahma9-Nov-13 23:04 
QuestionHeading text alignment problem Pin
Mark F.9-Nov-13 4:42
Mark F.9-Nov-13 4:42 
AnswerRe: Heading text alignment problem Pin
Richard Andrew x649-Nov-13 9:08
professionalRichard Andrew x649-Nov-13 9:08 
SuggestionRe: Heading text alignment problem Pin
Peter Leow10-Nov-13 4:22
professionalPeter Leow10-Nov-13 4:22 
GeneralRe: Heading text alignment problem Pin
Mark F.10-Nov-13 5:16
Mark F.10-Nov-13 5:16 
AnswerRe: Heading text alignment problem Pin
Peter Leow11-Nov-13 17:49
professionalPeter Leow11-Nov-13 17:49 
GeneralRe: Heading text alignment problem Pin
Mark F.19-Nov-13 5:15
Mark F.19-Nov-13 5:15 
Questionuse MySQL's but as true || false Pin
Jassim Rahma7-Nov-13 12:47
Jassim Rahma7-Nov-13 12:47 
QuestionActiveX Control Permissions Pin
Richard Andrew x647-Nov-13 12:20
professionalRichard Andrew x647-Nov-13 12:20 
AnswerRe: ActiveX Control Permissions Pin
shalu_june1412-Nov-13 10:33
shalu_june1412-Nov-13 10:33 
Questioninsert variable from include file Pin
Jassim Rahma5-Nov-13 8:44
Jassim Rahma5-Nov-13 8:44 
QuestionThis webpage has a redirect loop Pin
Jassim Rahma4-Nov-13 23:46
Jassim Rahma4-Nov-13 23:46 
AnswerRe: This webpage has a redirect loop Pin
thatraja4-Nov-13 23:55
professionalthatraja4-Nov-13 23:55 
AnswerRe: This webpage has a redirect loop Pin
Kornfeld Eliyahu Peter5-Nov-13 0:03
professionalKornfeld Eliyahu Peter5-Nov-13 0:03 
GeneralRe: This webpage has a redirect loop Pin
Jassim Rahma5-Nov-13 0:09
Jassim Rahma5-Nov-13 0:09 
AnswerRe: This webpage has a redirect loop Pin
Kornfeld Eliyahu Peter5-Nov-13 0:16
professionalKornfeld Eliyahu Peter5-Nov-13 0:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.