Analytics XSL (1) page 1/5

Source: Internet
Author: User

With the development of the Internet, more and more information is entering the Internet. The urgent demands for information exchange, retrieval, storage, and reuse make HTML, the most common markup language, increasingly stretched. HTML integrates data content and performance, which can be modified and cannot be retrieved. xml references HTML and database, Program The advantage of language: separating content and performance not only makes retrieval more convenient, but also facilitates data exchange and reusability between users.

XML is a meta-markup language that does not contain many fixed tags, providing more flexibility for Web developers. When we use HTML, the tag is just a simple display of the content, but it is not associated with the content, which makes further processing of the document inconvenient. For example, to indicate your resume, the HTML representation is as follows:

<HTML>
<Body>
<Table border = 1 cellspacing = 0>
<TH> name <TD> Yu Xichu <TH> gender <TD> male <TH> birthday <TD> 1977.5
<Tr>
<TH> skills <TD colspan = 5> database design and maintenance, web development
</Table>
</Body>
</Html>

Name Yu Xichu Gender Male Birthday 1977.5
Skills Database design and maintenance, web development
The look of the above example in the browser

Here, we cannot know what the content of th and TD indicates. If XML is used, the corresponding document (File Name: resume. XML) can be written as follows:

<? XML version = "1.0" encoding = "gb2312"?>
<Resume>
<Name> Yu Xichu </Name>
<Sex> male </sex>
<Birthday> 1977.5 </birthday>
<Skill> database design and maintenance and web development </skill>
</Resume>


The method of the previous example in the browser (ie5.0 or later)

Note:

Version ── specifies the XML document version, which can only be 1.0;

Encoding -- specifies the encoding type of the XML document. The value here is "gb2312", that is, "simplified Chinese ".

In comparison, we can use XML to customize the tag and use the tag to indicate the meaning of the content. In this way, it is very convenient to process documents on the Internet, and we will not be confused by a large number of formats when reading source files.

However, because XML does not specify the display mode for the tag, if we view the above two documents in the browser (ie5.0 or an updated version is recommended ), we will see that the XML document is not displayed as a table. Can't we display documents like HTML? The answer is no. Take personal experience as an example. Create another format file to show the display format of each tag. The content is as follows (the file name is 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:

The above are CSS styles. It is recommended that you refer to the relevant materials to familiarize yourself with CSS and use it later. We will not describe it here because of the length relationship. After you create the resume.css file, add the following text to the first line of your resume. xml file:

<? XML-stylesheet type = "text/CSS" href = "resume.css"?>


The method of the previous example in the browser (ie5.0 or later)

Note:

Here, an external CSS style file is referenced. The type specifies the style type (the value can be text/CSS or text/XSL) and the href specifies the file path.

Save the file, and then open the file with ie5.0. How is it? The format is different. It seems that the content of the document is not satisfactory, but the display effect is much worse than that of the HTML document. Can the XML document be displayed only in this way ?!

Tip:

1. to better understand and master XML, we recommend that you familiarize yourself with the syntax of HTML 4.0 and CSS 2.0. Master at least one of JavaScript and VBScript; programming experience, understanding of database theory and SQL can benefit everyone from learning XML.

2. tags in the XML document must appear in pairs. If it is an empty tag, it must end with a tag with the same name as "/", or use this <xml_mark/> to indicate an empty tag.

3. XML and the XSL document to be introduced below. attribute values must be enclosed by double quotation marks (") or single quotation marks.

4. the XML document must be a good structure (the XSL document is also a type of XML document). That is to say, the tag must have an end tag, which can be nested but not cross-organized. For example:

<Outer> <inner> </inner> <inner/> </outer>

Is legal, and the following form

<Outer> <inner> </outer> </inner>

It is incorrect. If an XML document fails during browsing, most of them violate the rules mentioned above.

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.