Template
The text content within the <xsl:template> label describes the form of the transformation result, called the output template. The value of the attribute match compares the template rule to the specified element or attribute, only the matching DOM nodes are processed, and the remaining nodes are ignored. The root node of the tree is the first match in the process, and the root node is represented by "/":
<xsl:template match= "/" >
Output template for root element
</xsl:template>
Then match the other nodes, at which point the name of the element object to be processed is indicated in quotation marks. If a "*" appears in quotation marks, it means that the rule applies to all element nodes that are not individually specified for processing. For example, the second template in the following example indicates that all nodes except the <Employee> element are to be processed:
<xsl:template match= "Employee" >
Output template
</xsl:template>
<xsl:template match= "*" >
Output template
</xsl:template>
In addition, you can use the path designator in the XSL to specify that elements of a particular location match the template. "//" represents an arbitrary depth position, such as <xsl:template match= "//employee" > The <Employee> element used to match any position in the document; if <xsl:template match= " Employee//name "indicates that all <Name> elements in the successor node of the <Employee> element are matched. Another path indicator is "/", which indicates a direct parent-child node relationship. Changing the "//" to "/" in the example above means that the <Name> element in the <Employee> element child node is matched.
Obviously, some tree nodes may correspond to multiple templates in the XSL, in which case only the last corresponding template will take effect, and the preceding template rule will be ignored by the XSL processor.
"/" is a node that represents the current document, similar to a DOS directory separator. For example,/people represents the selection of the people element under the root node, and People/person represents all Peson child elements under people element selection.
"//" represents all nodes in the current document. Similar to view the entire directory. For example,//people represents the selection of all people elements in a document, regardless of its level, and People//person represents all the person elements under the people element, regardless of how deep it is.