This period learns the XSL style method for use with XSL elements < Xsl:for-each >, < xsl:value-of >, < xsl:template > select Properties, < xsl: Apply-templates > 's Match properties, < Xsl:if >, < xsl:when > 's Test attribute, filter the scope of the element to provide greater flexibility.
XML is the same as 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 formed the Document Object Model DOM, through the object's properties, methods to access control of XML nodes.
We are not going to elaborate on the XML DOM in detail, as it can be written in a more extensive tutorial, and we'll discuss some common methods to get a general idea of the DOM's object approach.
Note: From the beginning of this period, all samples no longer provide complete source code, if you do not understand, please read the previous seven, and practicing.
One, End ()
Meaning: Returns the last element in the collection.
Example: Output last Resume
Suppose the XML file format is:
......< Resume >...</resume >......< resume >...</resume .....
The contents of the corresponding XSL file are:
< Xsl:for-each select= "Resume[end ()]" >......</xsl:for-each >
Or
< Xsl:templates match= "Resume[end ()]" >......</xsl:templates >
Or
< Xsl:apply-template select= "Resume[end ()]" >......</xsl:apply-template >
Second, index ()
Meaning: Returns the position of the element in the collection, the return value being an integer, where the first element returns 0
Example: Return to the previous three resumes
Resume[index () $le $3]
Note: index () is related to the parent element, see the following example:
< x >
< y/>
< y/>
</x >
< x >
< y/>
< y/>
</x >
Returns the first < Y > in all < x >