After a few days ago, we learned the writing and and three XSL elements of the XHTML document, which can be written in a fairly flexible XSL document. Today, it will learn the writing of XSL templates. We all know that short documents, the program is very good, but after the size increases, its complexity is also increased faster. We learned , , etc., you can use them to simply format the output for XML data, but if you encounter more complex XML format output, XSL follow request Write down, one is the difficulty of design, the scalability is poor, which is not conducive to the division of labor; the other, the modification is very poor, maybe the situation will move the army, which is not conducive to maintenance. The method of modular design in the program has been applied here! The XSL template refers to the design of XSL into a template (block), and finally combines these templates (blocks) into a complete XSL; it is better than ship and containers, we don't pile up all the goods, but Put these containers on the ship and then put these containers on the boat. This method allows you to consider the entire XSL design from the whole, then refine some of the forms into different modules, and then design these modules, and finally integrate them together, so that the macro is combined with micro. People have nature, standardize the requirements. Container? ? Writing template (block): syntax: Property: match - what kind of case is performed template. As a simplified description, the name of the tag is used here; where the top layer template must set the match to "/" Language - determine what scripting language in this template, which is valued with the Script tag in HTML The value of the Language property is the same. The default is the JScript Use the Match property to select a node that satisfies the condition from XML, and the template for forming a specific output form for these specific nodes. Hanging boxing box -? ? Call Template (block): Syntax: Property: SELECT - Determine what template should be performed in this context environment, that is, the template (block) created with the tag.
Order-by ─ Sort by sequencing standard, usually a sequence of sub-tags: Taking personal resume as an example, for ease of handling each of our hopes "skills" to use tags to < / skill> How many skills are enclosed, how many skills have such a marker pair, and the modified personal resume XML document is as follows: XML Version = "1.0" encoding = "gb2312"?> xml: Stylesheet TYPE = "text / xsl" href = "resume_template.xsl"?> 初 初 name> male sex> 1977.5 birthday> Database Design and Maintenance Skill> Web Development Skill> resume> document> then create a new XSL file resume_template.xsl, using template form, its contents are as follows: XML Version = "1.0" Encoding = "GB2312"?> Personal resume title> head> body> html > xsl: template>
Personal Resume ( Formatindex (ChildNumber (this), "I") xsl: eval>) CAPTION>