Construct an ASP. NET Website using XML + XSLT + CSS + JQuery (1)

Source: Internet
Author: User
Tags xslt

Preface

As earlyWebBefore the standardization trend came, I consideredXML + XSLTI think this is a very elegant, efficient, and low coupling solution that will surely become popular.

However, there are still a few people who use this solution to build websites.WebStandardization is not easy.WebStandardization only showsCss) Separated, and the data and structure are still mixed, it is definitely not our final destination, it is just a transitional product.

XHtmlThe original intention of setting up standards isXMLTransitional,XML + XSLT + CSSTo truly achieve the perfect separation of data, structure, and performance is our ultimate goal.

True,XML + XSLTIt does have technical difficulties. I think this is the biggest obstacle to its popularity. However, I feel that with the passage of time, the updating of concepts, and the development of tools, this is still a must-have site.

Introduction

XML + XSLT + CSSThe data, structure, and performance are separated based onJQueryWe can also easily separate the interaction, so that the client can achieve almost perfect decoupling.

On the server side, we are only responsible for input and output:

Input partWebServiceTo update server data.

The output part isXMLThere are two implementation schemes:

1. Dynamic type. Use an extension. AshxThe handler is responsible for outputXML, As long as you use this processing program to retrieve the data required by the client from the database and convert itXMLDocument output. The advantage of dynamic model is supportUrlParameter query and other complex query processing.

2. Static type. Discard the database and directly write all data used for renderingXMLFile. The advantage of the static type is that the server load is extremely low. When no data is submitted, the server willHTMLWebsites are much easier.

Advantages

Compared with various development solutions in the past, I have concluded that this solution has the following advantages:

1. Easier team collaboration. Full decoupling brings about refined division of labor and parallel development. In the past, there were always many kinds of development solutions with vague boundaries, which led to frequent consultations between the front-end and the background, programmers and designers, delayed sending efficiency.

For exampleXHTMLDocument, the designer should define the document structure above, andID,ClassThe front-end programmer needs to write client events on it, and the back-end programmer needs to insert the data obtained from the database to somewhere on the page. The work of the three parties is restrained by this.XHTMLIt is like an interface, which is shared by all three parties.

What is the situation in our solution? Backend programmers only need to deal with databases and business logic. When the client needs dataXMLThe document is enough;As a designer, as long as you knowXMLDocument structure, you can useXSLTFlexible layout arrangement, even if you need to modify the layout significantly, you do not need to bother background programmers to intervene, simpleXSLTSyntax is not a big problem for designers. Front-end programmers need to know the interactive controls in the user interface, arrange the Event Logic for them, and submit them to the backgroundWebServiceIn the left-side navigation pane.XML,XSLT,WebServiceIt is like three interfaces. One side can touch up to two of them.

Is the interface better or less? Let's take a look at the example of Sony Ericsson mobile phone. Most of Sony Ericsson mobile phones share an interface for headphones, charging, and data transmission, when charging, you cannot plug in headphones to listen to songs, when you plug in headphones to listen to songs, you cannot transfer data, and when you transfer data, you cannot charge, while other brands of mobile phones mostly use multiple interfaces, which one is more convenient and self-evident. Of course, from a security point of view, Sony Ericsson's single interface is better. Previously, there was news that a man was struck by lightning when he listened to songs on his mobile phone, the man shouted, "Ah! I am dead !"-_-#,Onlookers)

2. It saves more server resources. Bandwidth Resources: In this solution, each time you switch the page, all you need to download isXMLDocumentation, othersXSLT,CSS,JSYou only need to download it once, and you do not need to send the form back when submitting it.ViewState. Processor resources: the client displays all the codeXSLTIn the dynamic merging of clients, the work on the server side is only to process business logic and database interaction, which is extremely easy. The resource consumption level of this solution is slightly higherAjaxSolution, lessMVCSOLUTION, relativeWebForm,MVPAnd traditional script-based solutions, saving a lot of resources.

3. Easier search engine indexing. First, this solution can be indexed by search engines.AjaxThe disadvantages of the solution are as follows. Second, search engines prefer websites with Less redundancy, which affects website rankings to a certain extent.XMLThe data most meets this requirement. Furthermore, the website is more friendly, which is relativelyMVCFor more information, see me.An article published earlier.

4. It is easier to use in other clients. This pointAjaxThe solution is equally outstanding,MVPIt is difficult to implement the scheme, and it is difficult to implement other schemes.

Disadvantages

There is no perfect thing. The disadvantages of this solution are as follows:

1. Higher technical requirements. Obviously, compared with previous solutions, this solution requires developers to have more knowledge and combine applications.

2. Higher client load.XSLTThis increases the processing pressure on the client. Although we mostly think that the computing resource load on the client is a negligible problem, we can put as many operations as possible on the client, however, not all customers use high-end machines, especially for some netbook users,JSThey have a headache.

3. Poor compatibility.HTML,JS,CSSThere are some compatibility issues in various browsers.XSLTDevelopers are faced with more severe problems. In addition, for mobile clients, blind readers, and other unconventional clients,XSLTWhether it will be parsed is a question.


Related Article

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.