XML and XSL generation class PowerPoint organization map (2)

zhaozj2021-02-16  59

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

-------- Description

------- Contains container

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:

01

aaaa

0101

BBBB

......

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:

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:

转载请注明原文地址:https://www.9cbs.com/read-25221.html


New Post(0)