What is XSL
The full name Extensible Style Language is translated as an extended style language in Chinese and is used to format XML documents. It consists of two parts.
1 (XSLT): XSL Transformation Language(XSLT), it can convert XML documents from one format to another, such as converting to html, text or text-based documents.
2 (XPath): XSL formats objects, formatting objects provides another way to CSS
To format XML documents and apply styles to XML documents!
Use of XML
Data in the following Html format:
<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>
This html file cannot express meaning. If modified to: <?xml version="1.0" encoding="GB2312"?>
<About>
<Name>5do8</Name>
<ID>1</ID>
<Professional>.NET,PHP Design</Professional>
</About>
It can clearly express the meaning of the node. On the other hand, it is also conducive to developers to obtain data from the data layer more flexible.
Regarding XML files, please note:
The header of the xml file:
1: version Specifies the version of the XML document, which is 1.0;
2: encoding Specifies the encoding type of XML document. The value here is "GB2312", that is, "simplified Chinese". Please be sure to save the file in ANSI format. If there is still Chinese in the file, it is recommended that the format GB2312 or UFT-8, and the file header and saved type must be unified.
Regarding the body of the xml file, you need to pay attention to:
1: There must be a root node.
2: Nodes must appear in pairs.
3: Use escape characters to convert <,>, etc.
Two ways of outputting XML
There are two ways to perform the xml front-end page. One is CSS. The style sheet can simply output the page, but it cannot change the pattern, judge, and verify. Very monotonous. Not shown here.
Another more flexible one is to use XSL. Its role is to output XML files in the specified pattern, and the legal XSL format must also be an xml file.
XSL pattern language
XSL pattern languages are 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 introduces each mode in detail, please pay attention.
The full name Extensible Style Language is translated as an extended style language in Chinese and is used to format XML documents. It consists of two parts.
1 (XSLT): XSL Transformation Language(XSLT), it can convert XML documents from one format to another, such as converting to html, text or text-based documents.
2 (XPath): XSL formats objects, formatting objects provides another way to CSS
To format XML documents and apply styles to XML documents!
Use of XML
Data in the following Html format:
<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>
This html file cannot express meaning. If modified to: <?xml version="1.0" encoding="GB2312"?>
<About>
<Name>5do8</Name>
<ID>1</ID>
<Professional>.NET,PHP Design</Professional>
</About>
It can clearly express the meaning of the node. On the other hand, it is also conducive to developers to obtain data from the data layer more flexible.
Regarding XML files, please note:
The header of the xml file:
1: version Specifies the version of the XML document, which is 1.0;
2: encoding Specifies the encoding type of XML document. The value here is "GB2312", that is, "simplified Chinese". Please be sure to save the file in ANSI format. If there is still Chinese in the file, it is recommended that the format GB2312 or UFT-8, and the file header and saved type must be unified.
Regarding the body of the xml file, you need to pay attention to:
1: There must be a root node.
2: Nodes must appear in pairs.
3: Use escape characters to convert <,>, etc.
Two ways of outputting XML
There are two ways to perform the xml front-end page. One is CSS. The style sheet can simply output the page, but it cannot change the pattern, judge, and verify. Very monotonous. Not shown here.
Another more flexible one is to use XSL. Its role is to output XML files in the specified pattern, and the legal XSL format must also be an xml file.
XSL pattern language
XSL pattern languages are 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 introduces each mode in detail, please pay attention.