span>
xsl: for-energy>
xsl: template>
xsl: stylesheet>
The idea of design is:
It is first thought that the organizational structure is in the form of expression between the organizers: the upper layer (right, replaced by the parent) to include the lower layer (weight and sub-layer replacement), while each of the sub-layers contained by the parent layer It is equal to equality.
In this way, I think of the same structure for each layer: describing itself, and containers containing sub-layers, ie:
Description of yourself
Container containing sub-layers
Think of this, I think
span> -------- Description
Span>
Structure to represent a node. Because this can ensure that the nodes of each of the same layers are parallel, while achieving each node, the description thereof is up and down in the form of a description.
After determining the performance structure of the node, then consider the data performance format of the organizational structure, in order to ensure the versatility and easy accessibility of the organizational structure data structure, I don't consider organizing the nodes in the XML files in the XML file as in the actual organization structure. relationship. Because I take into account my XML file is generated from the database, if the generated XML file format is:
......
children>
Layer>
children>
Layer>
Although I look quite understand, the younger brother thinks that it is not very common, and it is also the most critical, with the SQL statement to get such a data structure from the database, 嘿嘿, the younger brother consciously, although there are some economies, but it really doesn't realize :) So give up. The simplest implementation method is to be as in Organize .xml, it looks from each node, although it is equal, but they are associated with each other, but they are associated with the ID = ID serial number of the child node, through ID To establish a sub-node of each other (ie: 0101, 0102, ... .010n is 01). In this way, the younger brother believes that even if a beginner, a book will be made to generate the SQL statement of this data structure. Seeing this, I can't hold the table, as the saying goes, "the developer who truly considers users is a good developer." In this word, the great and hardships of the younger brother, please suspend Everything in your hand, I am trying to my youep. Oh, finally, the applause slammed. . . . . .
It is determined that the data performance format of the organizational structure is determined, and the most critical XSL to consider will be targeted. Because the processes assumed by the younger brother are:
When retrieving a node, first, consider the description of the node, that is, the title of the node,
At the same time, the node is definitely found to have the sub-node to which you belong to and extract. For each node, the same operation is performed.
Since this is the case, according to the younger brother, in the programming, I touched rolling and touched the intuition of the East Wall, the West Wall, first felt, is recuing! . Hahahahahaha. . . . How do you think about the solution that you have thought to find? Oh, dark. The following is the younger brother according to what you think, the actual solution:
First start from the root node:
Then call the template getLayer to transfer the ID of the first child node of the current root node as a parametric incoming template:
xsl: Call-Template>
In the template getLayer, when a node is retrieved, the first is to extract the node's description. This can pass the XSLT statement
obtain. (For more detailed description of the following related XSLT statements, please refer to relevant information and books)
At the same time, through its own ID, the sub-nodes you are related to the relevant subsidy are retrieved in XML data. This is through: