473,245 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,245 software developers and data experts.

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>Level 0</description>
<contents>
<entity>
<description>Level 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="javascript:Toggle('{./description}');">
<img src="../images/closedfolder.gif" width="16" height="16"
hspace="0" vspace="0" border="0"/>
</a>
</td>
<td>
<a id="x{./description}"
href="javascript: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="javascript: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="javascript: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:otherwise>
<tr>
<td width="16">
<a id="x{./description}"
href="javascript: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="javascript: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 5774

"ragha" <pa********@yahoo.com> wrote in message
news:f5**************************@posting.google.c om...
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********@yahoo.com> wrote in message news:<bp*************@ID-152440.news.uni-berlin.de>...
"ragha" <pa********@yahoo.com> wrote in message
news:f5**************************@posting.google.c om...
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
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...
0
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...
0
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...
1
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...
4
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...
5
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...
8
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...
2
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...
3
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...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...

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.