473,721 Members | 2,259 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSL /XML replication of tree folder structure

Dear friends

I am emulating thr tree structure mentioned in the article
http://www.15seconds.com/issue/010921.htm

I have succesfully created the folder structure for level 2 I need
this structure till 5 level is there any easier way to generate this
using xsl

My xml tree node is

<tree>
<entity>
<description>Le vel 0</description>
<contents>
<entity>
<description>Le vel 1</description>
<contents>
<entity>Level 2</entity>
<contents>
<entity>Level 3</entity>

</contents>
</contents>
</entity>
..........

</contents>
</entity>
</tree>

xsl code which used to generate
<!-- First xsl for each start -->

<xsl:for-each select="tree/entity">
<table border="0" cellpadding="1" cellspacing="1" >
<tr>
<td width="16">
<a id="x{./description}"
href="javascrip t:Toggle('{./description}'); ">
<img src="../images/closedfolder.gi f" width="16" height="16"
hspace="0" vspace="0" border="0"/>
</a>
</td>
<td>
<a id="x{./description}"
href="javascrip t:Toggle('{./description}'); ">
<b><xsl:value-of select="./description"/></b>
</a>
</td>
</tr>
</table>
<DIV id="{./description}" style="display: none; margin-left: 2em;">
<!-- Second xsl for each start-->
<xsl:for-each select="./contents/entity">
<table border="0" cellpadding="1" cellspacing="1" >
<tr>
<td width="16">
<a id="x{./description}"
href="javascrip t:Toggle('{./description}'); ">
<img src="../images/openfolder.gif" width="16" height="16"
hspace="0" vspace="0" border="0"/>
</a>
</td>
<td>
<a id="x{./description}"
href="javascrip t:Toggle('{./description}'); ">
<b>
<xsl:value-of select="./description"/>
</b>
</a>
</td>
</tr>
</table>
<DIV id="{./description}" style="display: none; margin-left: 2em;">
<!-- Third xsl for each start -->
<xsl:for-each select="./contents/entity">
<table border="0" cellpadding="1" cellspacing="1" >
<xsl:choose>
<xsl:when test="string-length(./contents/entity)&lt;5">
<tr>
<td width="16">

<DIV id="x{./Programmeid}" style="display: hidden;">
<img src="../images/doc.gif" width="16" height="16" hspace="0"
vspace="0" border="0"/>
</DIV>

</td>
<td>

<b>
<xsl:value-of select="./description"/>
</b>

</td>
</tr>
</xsl:when>
<xsl:otherwis e>
<tr>
<td width="16">
<a id="x{./description}"
href="javascrip t:Toggle('{./description}'); ">
<img src="../images/openfolder.gif" width="16" height="16"
hspace="0" vspace="0" border="0"/>
</a>
</td>
<td>
<a id="x{./description}"
href="javascrip t:Toggle('{./description}'); ">
<b>
<xsl:value-of select="./description"/>
</b>
</a>
</td>
</tr>
</xsl:otherwise>
</xsl:choose>
</table>

<xsl:if test="string-length(./contents/entity)&gt;5">
<DIV id="{./description}" style="display: none; margin-left: 2em;">
<xsl:for-each select="./contents/entity">
<table border="0" cellpadding="1" cellspacing="1" >
<tr>
<td width="16">

<DIV id="x{./Programmeid}" style="display: hidden;">
<img src="../images/doc.gif" width="16" height="16" hspace="0"
vspace="0" border="0"/>
</DIV>

</td>
<td>
<b>
<xsl:value-of select="./description"/>
</b>

</td>
</tr>
</table>
</xsl:for-each>
</DIV>
</xsl:if>
</xsl:for-each>
</DIV>
</xsl:for-each>
</DIV>
</xsl:for-each>

If any one has easier approach to generate the tree structure kindly
suggest.

Regards
Raghavendra K
Jul 20 '05 #1
2 5807

"ragha" <pa********@yah oo.com> wrote in message
news:f5******** *************** ***@posting.goo gle.com...
Dear friends

I am emulating thr tree structure mentioned in the article
http://www.15seconds.com/issue/010921.htm

I have succesfully created the folder structure for level 2 I need
this structure till 5 level is there any easier way to generate this
using xsl

My xml tree node is [snipped]
xsl code which used to generate
[snipped]

If any one has easier approach to generate the tree structure kindly
suggest.


Yes.

Read about xsl:template and xsl:apply-templates.

In your code you need to have a single xsl:template matching "entity". No
need of using xsl:for-each or repeating the same code fixed number of times.
=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
Jul 20 '05 #2
Dear Novatchev,

Thank you for your response.

Regards
Ragha

"Dimitre Novatchev" <dn********@yah oo.com> wrote in message news:<bp******* ******@ID-152440.news.uni-berlin.de>...
"ragha" <pa********@yah oo.com> wrote in message
news:f5******** *************** ***@posting.goo gle.com...
Dear friends

I am emulating thr tree structure mentioned in the article
http://www.15seconds.com/issue/010921.htm

I have succesfully created the folder structure for level 2 I need
this structure till 5 level is there any easier way to generate this
using xsl

My xml tree node is

[snipped]

xsl code which used to generate


[snipped]

If any one has easier approach to generate the tree structure kindly
suggest.


Yes.

Read about xsl:template and xsl:apply-templates.

In your code you need to have a single xsl:template matching "entity". No
need of using xsl:for-each or repeating the same code fixed number of times.
=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
545
by: Andi Plotsky | last post by:
I need to synchronize 3 databases (1 Master and 2 replicas). I thought I'd give the Replica feature in Access2000 a whirl. I'm not sure I'm THAT impressed.....but maybe I'm just doing something wrong. I'll outline the issues below and then maybe someone who has experience with replicating this way can tell me if this is the route I should take, or if I should just use my own routine which compares strings for each field. 1) I've...
0
3312
by: John H. | last post by:
In effort to understand (Outlook) MAPI folder tree structure wrote simple linear code below to navigate tree. Successive "...Folders.GetNext()"'s return same folder at all levels of tree. What am I doing wrong or not understanding? Thanks.
0
1133
by: hortoristic | last post by:
We currently have a solution up and working on VS 2005 and bound to source control VSS 6. I want to now add our DATABASE folder from VSS to our existing solution. My first approach has been to create a new Database Project and to get it working. In our tree in VSS the folder structure is similar to the following:
1
17427
by: mailsatk | last post by:
Hello people! I am trying to do something that I don't know if anyone else might have tried before...I am writing a Macro in Excel that will give a user the list of all the folders present within a selected folder. I have been successful in getting that onto a spreadsheet using the Shell command... This is important for Project Managers who need to work with a lot of directories for their projects...especially when they want to create a...
4
7429
by: shuisheng | last post by:
Dear All, I'd like to build a structure similar to the folder tree which 1. Has a root. 2. Nodes can be folder or files. 3. Folder can contain folders and files. 4. Name of folders and files under a folder can not be same. Anybody can give me some hint?
5
1597
by: ken | last post by:
Hi, I set up replication with a Frontend/Backend database set up. I noticed that when I sync the master with the replica in the same folder where I set up the replication, everything works fine and when I test for conflicts I get what I expect. However if I change the folder to say Copy of Folder when I sync the master automatically wins all conflicts without asking me, for all tables except 1. I find this very unusual. Are there...
8
1481
by: Sharktbbtfy | last post by:
Hi, hoping someone can help. The situation is that an app I designed is installed on a desktop PC and six laptops,separately, which synchronise to the desktop once a day at random times. I have two questions: 1) Is it advisable to not have the design master as the mothership but have a replica on the desktop where the backend is named, e.g., replica of
2
2339
by: graphicsxp | last post by:
Hi, I have the following records stored in the database : TableName: Folder { FolderID, FolderName, TopLevel} TableName: FolderRelationship { ParentID, ChildID} This describes a folder tree structure. Note that only one record has TopLevel set to 1, this is the top folder in the structure.
3
4441
by: prasath03 | last post by:
Hi, I am struggling with the following problem. Can somebody pls help me?. I have a file name and have a folder File f1= new File("path of the folder");. The folder is a complicated folder structure i.e. contains various files and sub folders which contains further subfolders etc. I want to show the whole folder structure(like tree structure). But, the following code shows only the "WebContent" structure.Please find below the following...
0
8840
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8730
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9131
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8007
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6669
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5981
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3189
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2130
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.