Basic knowledge about XSL

Source: Internet
Author: User
Tags header xsl xslt

What is XSL

Full name Extensiblestylelanguage, Chinese translation extended style language, used to format XML documents, which consists of two parts.

1 (XSLT): Xsltransformationlanguage (XSLT), which converts an XML document from one format to another. such as converting to HTML, text, or text-based documents.

2 (XPath): XSL Format object, formatting object provides another way of CSS

To format the XML document and apply the style to the XML document!

Use of XML

Data in HTML format as follows:

<HTML>
<BODY>
<TABLE border=1 cellspacing=0>
<TH>Name<TD>5do8<TH>ID<TD>1
<TR>
<TH>Professional:<TD colspan=5>.NET,PHP Design
</TABLE>
</BODY>
</HTML>

The HTML file cannot be ideographic, if modified to:

<?xml version="1.0" encoding="GB2312"?>
<About>
<Name>5do8</Name>
<ID>1</ID>
<Professional>.NET,PHP Design</Professional>
</About>

Can clearly indicate the meaning of the node. On the other hand, it's also more flexible for developers to get data from the data tier.

With regard to XML files, you need to note:

Header of XML file:

The 1:version stipulates the version of the XML document, which is 1.0;

2:encoding the encoding type of XML document, where the value is "GB2312", that is, "Simplified Chinese", be sure to save the file in ANSI format, if the file also has Chinese, the proposed format GB2312, or UFT-8, the file header and save the type should be unified.

With regard to the body of an XML file, you need to note:

1: Must have a root node.

2: Nodes must appear in pairs.

3: To use the escape character conversion <,>.

Two ways to output XML

In the performance of the XML foreground page, there are two ways, one is CSS, style sheet can be a simple output page, but can not change the pattern, can not judge, can not verify. It's very monotonous. This is not a table here.

Another, more flexible, is the use of XSL, which acts as a role in outputting the XML file in the specified mode, and the legitimate XSL format must be an XML file.

Schema language for XSL

The pattern language of XSL is divided into three types:

1: Select mode:

<xsl:for-each>,<xsl:value-of>,<xsl:apply-templates>

2: Matching mode

<xsl:template>

3: Test mode

<xsl:if> and <xsl:choose>

Each of the following tutorials details each pattern, please.

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.