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
.
Choose
In this case, the when tag checks the XML for the quantity tag. If the quantity tag contains an error property with the value True, the quantity tag will display the table cell listed below. If the value of the property is not true, the XSL displays the content between the otherwise tags. In the following example, if the error property is not true, nothing is displayed.
For-each
The For-each loop starts when the program encounters a lab
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
XSL is to XML like CSS to HTML. It refers to the Extensible Stylesheet Language (extensible Stylesheet Language). This is a language for rendering XML data in a readable format. XSL actually contains two parts:
* xslt– the language used to convert XML documents
* xpath– language for navigating in XML documents
XSLT refers to the XSL
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
paragraph is executed, and if False (false) it is not executed. It is basically the same as the concept of an if statement in C + +.We used the For example, a piece of XML code is like this:Wang Shuo Web site = "www.wangshuo.com" "The place of famous writers and renowned criticsWe can use The above includes most of the basic syntax for XSL, with a more detailed and complete introduction to the latest documents related to the WWW.W3C.ORG/TR, which can
analysis above, we can see that XSL actually adopts the idea of a transformation, which eventually transforms the XML document into another document that can be used for output, while the CSS does not have any transformation action, and no new code is generated throughout the process. In addition, the 90% style specification in
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
Original: A Egil refsnes translation: Atzie
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 set of xs
Tutorial
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 yourself an
xml| Design
XSL expands the style language (extensible styling Language), an xml-based language used to transform XML data. This conversion can take place between one format of XML and another, either from XML to H M L format or from XML to any type of text output.One of the reasons that XSL is produced is that XML is used purely for data. We have said that XML tags are used only to identify data, unlike th
the Java Transformerfactory method to generate a style sheet:
Transformerfactorytransformerfactory = Transformerfactory.newinstance ();
Transformer = Transformerfactory.newtransformer (Getstylesheet ());
Just a few lines of Java code to complete the conversion:
Transformer Transformer = Gettransformer ();
STRINGWRITERSW = new StringWriter ();
Streamresult result = new Streamresult (SW);
if (transformer!= null) {
Transformer.transform (New Domsource (Document.getdocumentelement ()), result
Java upward transformation and downward Transformation (with a detailed example), java Transformation
Java upward and downward transformations (for example)
Examples of upward and downward Java transformation compiled by staying up late are very easy to understand ~~~~
1. Upward Tr
DCT transformation, DCT inverse transformation, and Block DCT Transformation
You are welcome to reprint it, but please indicate the source!I. Introduction
The full name of DCT transformation is the discrete cosine transform (discrete cosine transform), which is mainly used to compress data or images and convert the si
If you wowould like to generate the DOCTYPE specification in the html output when using xslt transformation, you can not write the code as following:
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->Xmlns: xsl = "http://www.w3.org/1999/XSL/Transform">
It is because we can not write the DOCTYPE element in the xslt f
code for an example of an XML document (Cd_catalog.xml) that we mentioned above:...The following is the complete XSL file (cd_catalog.xsl):
Note that the XML file is not yet added to the XSL stylesheet and has not been converted to an HTML file.The following is the HTML code to implement the final transformation with Javasript:
JavaScript is used in the
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.