In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains the "XSL loop construction method", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's ideas slowly in depth, together to study and learn the "XSL loop construction method"!
XSL (EXtensible Stylesheet Language) it refers to the extensible stylesheet language. XSL is to XML what CSS is to HTML. To put it bluntly, it outputs the data in XML in the specified display format. XML, unlike HTML, does not contain any information about the display format. XSL contains two parts:
XSLT-the language used to transform XML documents. XSLT refers to XSL XSL Transformation XPath-the language used to navigate through XML documents
XSL Syntax the first line of any XSL document is actually a XML declaration:
XSL and XML? Follow the same grammatical rules
After the XML declaration, it is the XSL declaration, for example:
.
The XSL declaration must have a closing tag, and the above declaration also contains the namespace and the version of the XSL specification.
What is a namespace?
It specifies a set of element and attribute names that can be used in a particular document. The purpose of namespaces is to avoid naming conflicts. Because XML and other XML-related languages are user-defined, naming conflicts can occur. It could mean a layout or a seat. Because most applications process multiple XML documents at the same time, there are often situations where different XML documents are mixed, and an element may have different meanings in these documents. Several documents use the same namespace to ensure that elements represent the same meaning in each document. Otherwise, you should use different namespaces to ensure that elements represent different meanings.
The namespace is specified by the xmlns attribute in the document declaration, which is actually the address of the Web site (for example, http://www.w3.org/1999/XSL/Transform). The basic principle is that URI is unique, so the corresponding namespace is unique. The URI in the document declaration is used as a name only.
Templates or rules
XSL documents are made up of templates or rules, each of which defines the rules that apply to a particular XML node. The XSL template is as follows:
. The function of the template is to carry the data in the XML document, just like a mold, if the mold is square, then the model made with this mold must be square, and the data in the XML document is used to fill the raw material of the mold. You can actually nest subtemplates within a template, but the top template must have match set to "/".
Happyold.xml
Cnbruce
ten
Male
He is a terrible guy!
Yufuzi
eighty
Male
He is an excellent man!
Xiaojin
twenty
Male
There's something wrong with his character!
Cyclic structure
. It has the same effect as the typical for cycle.
Old.xsl
Name
Age
Gender
Description
Put old.xsl and happyold.xml in the same folder, and then jump in line on the second line of happyold.xml
Then preview the display result in the browser.
Using loop construction, you can also filter output based on conditions. Suppose you only want to show members over the age of 30.
Old30.xsl
Name
Age
Gender
Description
To define the conditions for a XML node, you can use any of the following operators:
Equal to (=)
Not equal to (! =)
Less than (=)
Use a construct to sort the output by the specified node, and the element must be nested within the element to ensure that the application can cycle through all projects. The sort element does not have a corresponding closing tag, so add a "/" at the end to make it self-ending.
Old_sort.xsl
Name
Age
Gender
Description
Remove the order= "descending" and look at the display result.
Conditional construction:
There can be more than one when in a conditional construction, but only one otherwise to handle all other cases that are not included in the initial test condition.
Old_choose.xsl
Name
Age
Gender
Description
Thank you for your reading, the above is the content of "the method of XSL loop construction". After the study of this article, I believe you have a deeper understanding of the method of XSL loop construction, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.