R
ragha
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)<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>
<xsltherwise>
<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>
</xsltherwise>
</xsl:choose>
</table>
<xsl:if test="string-length(./contents/entity)>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
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)<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>
<xsltherwise>
<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>
</xsltherwise>
</xsl:choose>
</table>
<xsl:if test="string-length(./contents/entity)>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