Learn XSL with me (1)

zhaozj2021-02-08  243

With the development of the Internet, more and more information enters the Internet, information exchange, retrieval, preservation, and reuse such an urgent need to make HTML this most commonly used markup language has become more and more stretched. HTML integrates data content and performance, modifiable, data can retrieval, and XML draws on the advantages of HTML and database, program language, and separates the content and performance, not only makes it more convenient, but also users. The exchange between data is more convenient, and it is more reusable.

XML is a meta-marker language, without many fixed tags, providing greater flexibility for web developers. When we use HTML, the tag is just a simple representation of the display, and there is no association with the contents of the representation, which is extremely inconvenient for the further processing of the document. For example, to represent your resume, use HTML representation as follows:

Name 禹 希 初 Gender Male Birthday 1977.5

Skill Database Design and Maintenance, Web Development

Here, we cannot know what its content is not known from the mark th, and if you use XML, the corresponding document (file name: personal resume .xml) can be written as follows:

初 初

Male

1977.5

Database Design and Maintenance, Web Development

Description:

Version - The version of the XML document is specified, which can only be 1.0;

Encoding - The encoding type of the XML document is specified here, which is "GB2312", which is "Simplified Chinese".

Compare two cases, using XML we can customize the mark, indicate the meaning of the content. In this way, when communicating the information on the Internet, it provides a great convenience with the computer processing document, and we will not be able to make a bulldy steering when you read the source file.

However, since XML does not display the display mode, we will see that the XML document is displayed in a manner, such as a table. Can we display a document like HTML? The answer is negative. Taking a personal resume as an example, you need to build a format file to explain the display mode of each tag, its contents are as follows (assuming the file names resume.css):

Resume {display: block;}

Name {Display: block; font-size: 120%;

Sex {Display: block; text-indent: 2em}

Birthday {display: block; text-indent: 2em}

Skill {Display: Block; Text-Indent: 2em}

Note: All of the above CSS style, it is recommended that the reader is familiar with the relevant information, and must be used in later learning, which is not introduced by the space relationship. After establishing the file resume.css, add the following text after the first line of the personal resume .xml file:

Description:

Here, it refers to an external CSS style file, where Type specifies the style type (which is TEXT / CSS or Text / XSL), HREF specifies the file path.

Save the file and open the file in IE5.0. how about it? The format is somewhat different. It seems that it is not satisfactory, the content of the document is clear, but the display effect is much better than the document written by HTML, and the document written by XML can only display this way? !

prompt:

1. In order to better understand and master XML, it is recommended that you are familiar with HTML 4.0 and CSS 2.0 grammar; master at least one of JavaScript, VBScript; programming experience, understanding database theory and SQL can make everyone benefit when learning XML .

2. The tiba in the XML document must be paired, if it is empty mark, there must be the end "/" of the same name tag, or use this kind of text to represent an empty tag.

3. XML and the XSL documentation will be introduced next week, the attribute value must be enclosed in double quotation marks (") or single quotes (').

4. The XML document must be a good structure (XSL document is also one of the XML documents), that is, the tag must have end tags, and the tag can nest but not cross, such as

Is legal, and below

It is wrong. If the XML document is erroneous, most of them violate the rules mentioned above.

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

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.054, SQL: 9