Using XSLT to easily fold the navigation bar tree (1)

Source: Internet
Author: User
Tags xsl file xslt
Generally, the XML file we see is based on elements. as the layers continue to deepen, it gradually becomes a tree, the benefit of such files is that we can understand the child, parent, ancestor, and sibling relationships at a glance. the inconvenience is that, I personally think that the XML file we usually see is based on elements. as the layers continue to deepen, it gradually becomes a tree, the benefit of such files is that we can understand the child, parent, ancestor, and sibling relationships at a glance. the inconvenience is that, in my personal opinion, if there are many sibling nodes at a deep level, the file processing efficiency may be greatly affected. Due to the flexibility of XML to describe the data structure, attribute values are used to describe the relationship between elements in some environments. For example, the TOC (table of content) on the left OF the garden, the XML file that implements it, uses the attribute value to clarify the element type (node or leaf), but there are still child nodes in it, therefore, the XSL file used for TRANSFORM is very complex and involves several situations. Of course, today we are not talking about the implementation of garden TOC, but using a faster and more amazing way to implement similar TOC. of course, it can also be called 'Tree folding navigation bar '. Well, let's leave it empty and get into the question. Let's take a look at a simple DTD. NAVIGATOR. DTD




The file is very simple. you can understand that the top-level element Navigation contains multiple Navigator element definitions. Navigator does not contain elements but has a series of attributes. You may have invented two attributes named AncestorID Childs. By the way, these two attributes are crucial, and of course there are layers, the relationship between Navigator elements will be clearly described. Now let's take a look at the Navi. xml file, using garden TOC as an example.

View examples of garden TOC:

NAVI. xml
































In conjunction with the TOC on the left of the garden I mentioned above, it is easy to find out the relationship between elements after careful analysis of this file. it is difficult to think of how to create an XML file. Okay, with the data, the next step is how to MANUPILATE.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.