XML + XSL + JS builds a small web app (1)

zhaozj2021-02-16  58

XML XSL JS builds a small web app

Summary: This article describes how to use XML, XSL technology, to separate the contents and display styles. Other techniques used include: XMLDOM, JavaScript.

Keywords: XML, XSL, JavaScript, Web Application, Xmldom.

I went a part-time job a few more time, I asked to provide a work, I came to this, and I feel too simple. I didn't have a good idea, but I didn't feel this, but I also achieved some ideas. Fortunately, you can put it here if you have a bit helpful, that is honored.

Introduce this "small things" in the following aspects: demand and design, specific implementation, and small knots.

First, demand and design

demand:

Do a small web application for your resume, require the following features: 1. You can choose the content of different style style to view the resume, and filter the content according to the needs of the needs. 2. Can manage the content style of the content. 3. Manage the resume needs to enter a password. 4. The resume file is copied to other computers, can still complete the above operations.

Based on the above four-point needs, do the following analysis:

1. Use multiple files to complete the requirements (HTM files, JS files, XML files, and XSL files). Use the XML file as a Setting file (profile) and data log file, XSL files as style information record files, and the JS file is put to implement "Business Logic" JavaScript Function. Users accesses the HTM file and call these features. 2. The resume information is stored with an XML file, and the demand for different styles of style is implemented and screening the content by using different style single files. 3. Use JavaScript and DOM technology to operate the XML file to implement the editing function of the resume content. 4. Password encrypted storage.

design:

There are two ideas to consider adopting, as follows: 1) File list, the framework is as follows: index.htm // Entrance file, through the display / hidden layer to display the destination of different contents index.htm.files // folder | - JS / / Folder, store JavaScript file | - data // folder, store data file, XML format | - styles // folder, store style file, XSL format | - Images // folder - setting.xml // configuration file , XML format

2) File list, the framework is as follows: index.htm // Entrance file, use the frame index.htm.files // folder | - js // folder, store the JavaScript file | - DATA // folder, store data files, XML format | - styles // folder, store style file, XSL format - setting.xml // configuration file, XML format - Welcome.htm // Welcome page - DISP.HTM // Show resume - Edit.htm // Edit Resume - set.htm // Setting / Change Password, display style two ideas, ideas I use ideas 1), without page delivery parameters, the program is relatively stable, and the client browser is adaptable. The use of DIV is similar to the ASP: Panel in ASP.NET in this idea. Based on such frame design, content-related information is saved in the XML file, and the information of the display style is recorded in the XSL file, which is convenient to replace the display style. The reuse rate of the code is very high. This can be deeply understood in the process of concrete implementation. This is also the principles and obvious advantages of XML technology advocacy.

转载请注明原文地址:https://www.9cbs.com/read-25775.html

New Post(0)