With the introduction of the previous two chapters, we have some understanding of the basic concepts of XSLT and its transformation process. Let's learn the specific syntax of XSLT together. When it comes to grammar, it's always boring, and you can go through it in general, and then look at it when you really need to use XSLT.element
With the introduction of the previous two chapters, we have some understanding of the basic concepts of XSLT and its transformation process. Let's learn the specific syntax of XSLT together. When it comes to grammar, it's always boring, and you can go through it in general, and then look at it when you really need to use XSLT
Grammar
3.5 Xsl:choose, Xsl:when and Xsl:otherwise
The XSL:IF syntax does not have an else attribute. If we are going to make multiple choices, we need to use the Xsl:choose/xsl:when/xsl:otherwise series Process Control syntax. For specific use, see the following XSL file example:
No name available
Description: First in the People node to find Name available ".
3.6 Xsl:sort
this is not a pig
5) xsl: value-of displays the value of the selected node or attribute.
Select sub-node price
Select weight
6) xsl: attribute: construct the attributes of an xml node.
Used to add attributes to a node, for example:
Output
7) xsl: apply-templates application Template
If the xml file structure is complex, you can define multiple templates and then use
The label application template. for xsl: apply-templates, you can specify the select = "xpath"
Chapter 3 XSLT element syntax
ArticleAuthor: A Jie
Through the introduction in the previous two chapters, we have learned some about the basic concepts of XSLT and its conversion process. Next we will learn the specific synt
Through the introduction in the previous two chapters, we have learned some about the basic concepts of XSLT and its conversion process. Next we will learn the specific syntax of XSLT. When it comes to syntax, it's always boring. You can simply browse it and study it carefully when you really need
4.3.4 XSLT syntax and functions In the previous example, I believe that the reader has probably understood the general form and functions of XSLT. In this section, we will discuss it comprehensively.
Document Structure
As mentioned above, the XSLT document itself is an XML docume
Chapter 4: XPath syntax
ArticleAuthor: A Jie
4. XPath syntax As we have mentioned earlier, XPath is a language used to help XSLT search for location information in XML source documents. In actual use, XPath and XSLT
4.XPath of syntaxAs we mentioned earlier, XPath is the language used to help XSLT find positioning information in an XML source document. In actual use, XPath and XSLT are always mixed together, and in the syntax examples in the previous chapter we already have the syntax to use XPath, just not explicitly. But the cons
Element Syntax of XSLTXSL: Template and XSL: Apply-templatesXSL: value-XSL: For-eachXSL: IfXxsl: Choose, when, otherwiseXSL: Sort
XSL: Template and XSL: Apply-templates Template is one of the most important concepts in XSLT. An XSLT file is composed of one template. Any XSLT file contains at least one template. The
3.1xsl: template and xsl: apply-templates template are one of the most important concepts in XSLT. An XSLT file is composed of one template. any XSLT file contains at least one template. The concept of a template is like building blocks.
3.1 xsl: template and xsl: apply-templates
Template is one of the most important concepts in
Grammar
4.4 Functional Functions (functions)There are many functional functions in XPath that can help us pinpoint the nodes we need.Count () featureFunction: Statistics count, returns the number of nodes that meet the criteria.For example: Description: The purpose of the code is to display the name attribute value for the person element as Tom has several.Number () featureAction: Converts the text in the value of a property to a numeric value.Example: Description: The purpose of the code is to
Position () function--return node position
Syntax: Position ()
Parameters: None
return value: Integer
Purpose: This function is used to return the position of the context node in the collection of nodes being processed.
The following sample program demonstrates the use of the position () function.
The XML source document is shown below.
[XHTML] View plain copy The XSLT document is shown below.
[XHTML] View
3.2xsl: value-ofXSL: value-of is used to write the text values of elements in the source document to the output document. For example, there is an XML document for personal materials :? Xmlversion = "1.0" encoding = "iso-8859-1 "? PERSONnameajie/nameage28/age/PERSON
3.2 xsl: value-
XSL: value-of is used to write the text values of elements in the source document to the output document. For example:There is an XML document for personal materials:
Ajie
28
example:
7) XSL: Apply-templates Application Template
If the XML file structure is complex, you can define multiple templates, and then use the
See the following sample XSLT file pets-templates.xsl Complete sample XSL file: pets. XSL
complete example file pets-templates.xsl:
in C #. net, which can also be used to convert XML documents using compiledtransform. However, this class has been marked obsolete by Microsoft and should
Template rules match the nodes in the Document Tree by using the mode. Mode specifies a set of conditions for selecting the nodes to be processed. The pattern matching syntax can be used not only in the match attribute of the The following lists common usage of pattern matching: 1. matching the root node, for example, indicates matching an element that has an ID type property and its value is equal to the E-2001320001. To work in this way, you must
3.4xsl: ifxsl: if is similar to the if condition statement in a common programming language. it is processed by the template when the node is set to meet a certain condition. The syntax format of xsl: if is: xsl: iftest = boolean expression templatebody/xsl: if for example: xsl: templatematch = "PEOPLE" xsl
3.4 xsl: if
Xsl: if is similar to the if condition statement in the common programming language. it is processed by the template when the node
many other XML family members, XSLT was drafted and developed by the consortium. Its main development process is as follows:.1995 proposed by James Clark;. The August 1997 official proposal was XSL;. A demand summary was completed by Norman Walsh in May 1998;. August 18, 1998 the release of the XSL draft;. November 16, 1999 the official release of the XSL 1.0 recommended version.Currently, XSLT is still ev
Concept
OutlineThis article is divided into five chapters: the XSLT concept, the XSLT instance, the XSLT element syntax, the XPath syntax, and the XSLT resource.The concept of 1.XSLT1.1 What is XSLT1.2 Why do you use XSLTThe hist
Programming (XP) technology.
3, try to make XSLT style sheet simple.
There are at least two reasons to keep your XSLT stylesheet simple. First, XSLT is not a programming language as rich as java. Although XSLT is a good translator, embedding too many application logic into a stylesheet can make it quite complex. For
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.