What is XSL
Full name extensible Style Language, Chinese translation extended style language, used to format XML documents, it consists of two parts.
1 (XSLT): XSL transformation Language (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 pro
This is called the separation of data and display, which is very good. When we want to change the wind, we only need to change the XSL and do not need to add a new copy of data. But sometimes there are special cases. For example, we have this strange requirement-writing XMLXSL to a file. There was no result after Baidu; suddenly, there was no popular Q A website
This is called the separation of data and display, which is very good. When we want to ch
Original: A Egil refsnes translation: Atzie
Two. Transformation of XSL
1. Convert XML to HTMLHow does XSL convert an XML document into an HTML file? Let's take a look at an example where the following is part of an XML document:
...
We then convert the XML data to an HTML file as an HTML template for the following XSL file:
In the above code, the role of t
Tutorials | transformations
Two. Transformation of XSL
1. Convert XML to HTMLHow does XSL convert an XML document into an HTML file? Let's take a look at an example where the following is part of an XML document:
USA
Columbia
...
We then convert the XML data to an HTML file as an HTML template for the following
How do I define attributes in an HTML tag in XSL using the value of XSL??[XML]XML version= "1.0"?>xml-stylesheet type= "text/xsl" href= "exam.xsl "?>Test> Test_type>ExamTest_type> TestIDID= "1"> say>What's the matter?say> Answers> AnswerID= "00001">I knowAnswer> AnswerID= "00002">I understandAnswer> AnswerID= "00003">YesAnswer> AnswerID= "00004">Go
Original: Jan Egil refsnes
5. XSL Index
If I want to arrange the display of elements in a certain order, how should I create an XSL index?
Let's take a look at the previous example.Code:
.
.
.
When an XML document is converted to an HTML file, the index should be created at the same time. The simple method is to add an order-by attribute to your for-each e
Tutorials | index
Five. The index of the XSL
How do I establish an XSL index if I need to arrange the display of the elements in a certain order?Let's take a look at the previous example, or the code:
USA
Columbia
.
.
.
When an XML document is converted into an HTML file, the index should be established
In the last period we learned about the XSL element Grammar:Properties: None, representing the start of a multiple-selection test
Grammar:Property:expr── a script language expression that evaluates to True or false, and if the result is true, and the content is displayed in the output (this property can be omitted).The script language type of an expression in the Language──expr property, with the same value as the Language property of the HTML tag sc
the conditions, true is returned"
$ Any $
Set operator. If any item in the Set meets the conditions, "true" is returned"
|
Set operator, returns the union of two sets
Example 1:
Find the name and e-mail of the person with "Web development" skills from his/her resume. Assume that the document structure is as follows:
.........
Find out the names of all persons with web development skills and e-mail's
This section describes the methods and attributes added by multiple XSL for VBScript and JScript to give full play to the advantages of XML, which are used for
1. absolutechildnumber
Meaning: return the sequence number of the node relative to all its brothers (regardless of whether the name is the same.
Syntax: absolutechildnumber (node)
Parameter: node-object. The node number to be returned.
Example:
1. Assume that the document struc
Original: A Egil refsnes translation: Atzie
Six. XSL filtering and querying
What should we do if we want to show only the XML data that satisfies certain criteria? Or the example code above, we just need to add parameters to the Select attribute of the Xsl:for-each element, like this:The logical choices for parameters are:= (equal To)=! (Not equal to)> greater than or equal
The same example as before (cd_catalog_sort.xsl):
You can test for yours
Sometimes, we might want XML documents to be output with some statistical information or something like numbers, and it's not easy to make use of the previous knowledge. Two new elements
Meaning: Computes a script expression, outputting a text string.
Grammar:
Property:
language── the name of the scripting language used, the available attributes are "JavaScript", "JScript", "VBScript", "VBS", and so on, and the default is "JScript".
Meaning: Declares a global variable or defines a fu
This period learns about XSL style methods for use with the select Properties of XSL elements
XML is like DHTML (Dynamic HTML), these nodes are all objects, and these objects are layered, starting from the root node to form a hierarchical clear tree structure, which forms the Document Object model DOM, which is based on the object's properties, method to achieve the purpose of accessing the control XML no
Original: Jan Egil refsnes
Vi. XSL filtering and query
What should we do if we want to display only XML data that meets certain conditions? Or the above exampleCodeYou only need to add parameters to the select attribute of the XSL: For-each element. For example:
The logical options of parameters include:
= (Equal)
=! (Not equal)
Lt less
Gt greater than or equal
The same as the pr
Original: A Egil refsnes translation: Atzie
Five. The index of the XSL
How do I establish an XSL index if I need to arrange the display of the elements in a certain order?Let's take a look at the previous example, or the code:
...
When an XML document is converted into an HTML file, the index should be established at the same time. The easy way to do this is to add a order-by attribute to your for-each
|
Collection operator, which returns a union of two sets
Example one:
Look for the name and e-mail from your resume for people with "web development" skills. Suppose the document structure looks like this:
.........
The XSL document structure for the names and e-mail of all the people who have web development skills is found in the above-structured personal resume as follows:
Description
1.[]── Indicates the selection
(such as online stores. Web programming languages are more suitable for this purpose.
XSL cannot replace or supplement CSS. It should not (or cannot) be used to set HTML styles. However, you can use it for websites that require high frequency, new design visualization, frequent layout changes, and mobile data processing.
XSL is not a content governance tool. It
The copy and copy-of structures are used to copy nodes. The copy element only copies the current node without any nodes or attributes. But copy-of is all copied.
XSLT stylesheet 1
XML source codeOutputCompare Compare these constructs.View in HTMLCopy-:CompareThese constructs.Copy:Value-:Compare these constructs.
XSLT stylesheet Xmlns: XSL = 'HTTP: // www.w3.org/5o/#/transform'> Div > B > B >Div > Div > B > B > Div > Div > B > B > Di
Tutorials | control | statements
Seven. XSL Control statements
1. Conditional Statement If...thenXSL also has conditional statements (hehe ~ ~ Good, like the program language). The specific syntax is to add a xsl:if element, similar to this... some output ...
The example above is rewritten as:
2. Choose of XSLThe purpose of choose is to have multiple conditions, giving different display results. The specific syntax is to add a s
This issue introduces multiple XSL methods and properties for VBScript, JScript, to give full play to XML advantages, for
First, Absolutechildnumber
Meaning: Returns the ordinal number of a node relative to all its siblings, regardless of the name.
Syntax: Absolutechildnumber (node)
Parameters: node── object, to return the number of nodes.
Example:
1, assuming that the document structure is:
Absolutechildnumber (This.selectnodes ('/document/b
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.