473,396 Members | 1,784 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,396 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 5781

"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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.