[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Expandeable Tree!

Subject: Re: Expandeable Tree!
From: António Mota <amsmota@xxxxxxxxx>
Date: Fri, 11 Feb 2005 12:34:54 +0000
sarissa tree
I'm doing something similar (almost done!) but all in the client side,
using Javascript (Sarissa) . My structure is a little bit more
complicated and i have now 4 or 5 diferent XSLT to take care of it.

But from the beggining i choose to clearly separate the "treatment" of
the tree from the display, so when a user clicks a link i have allways
at least 2 XSLT to invoke, the first determines what are the brenches
to show and the second to do the html rendering.


On Fri, 11 Feb 2005 09:21:10 +1000, Adam J Knight
<adam@xxxxxxxxxxxxxxxxx> wrote:
> Hi all,
> 
> First time posting, so I hope I am doing ok.
> 
> I have a xml document that gets generated from a database (MySql).
> <?xml version="1.0"?>
> <tree>
>   <tree_node id="7" depth="0" parent="0" value="Test">
>     <tree_node id="8" depth="1" parent="7" value="Test Sub"/>
>     <tree_node id="9" depth="1" parent="7" value="Test Sub One">
>       <tree_node id="10" depth="2" parent="9" value="Test Sub Two"/>
>     </tree_node>
>   </tree_node>
> </tree>
> 
> I am seeking to create a similar control to the one seen here:
> http://www.15seconds.com/issue/010921.htm
> 
> However all xsl processing is done server side (Using PHP 4 XSLT Processor).
> Default view is all level (depth) 0 nodes displayed. A user clicks a html
> link that sends the id of the node clicked to the xsl file as a parameter
> and all children nodes are displayed. If depth is greater than one, all
> ancestor nodes will need to be displayed also.
> 
> Here is the beginning of my stylesheet.
> 
> <?xml version="1.0" encoding="iso-8859-1"?>
> <xsl:stylesheet version="1.1"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> 
>     <xsl:param name="css"/>
>     <xsl:param name="c_node"/>
>     <xsl:param name="url"/>
> 
>     <xsl:output method="html" indent="yes"/>
> 
>     <xsl:template match="tree">
>         <table class="{$css}" align="center">
>             <xsl:apply-templates />
>         </table>
>     </xsl:template>
> 
>     <xsl:template match="//tree_node">
>         <tr>
>             <td width="{(@depth + 1) * 20}" align="right">
>                 <a href="{$url}&amp;node={@id}">+</a>
>             </td>
>             <td>
>                 <xsl:value-of select="@value"/>
>             </td>
>         </tr>
>       <xsl:apply-templates select="*[descendant-or-self::*/@id=$c_node]"/>
> 
>     </xsl:template>
>  
> </xsl:stylesheet>
> 
> I am only acquainted with xsl, so I would sure appreciate any suggestions on
> how to do this. I can't get past displaying the level (depth) 0 nodes, even
> when I click the appropriate link.
> 
> Cheers,
> Adam

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.