|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Display Tree Nodes Incrementally based on ID.
Hi all,
Still laboring over this style sheet. I have started reading up on axis'
XML STRUCTURE:
<?xml version="1.0"?>
<tree>
<tree_node id="7" value="Test">
<tree_node id="8" value="Test Sub"/>
<tree_node id="9" value="Test Sub One">
<tree_node id="10" value="Test Sub Two">
<tree_node id="11" value="Test Sub Three"/>
<tree_node id="12" value="Test Sub Four"/>
</tree_node>
</tree_node>
</tree_node>
</tree_node>
</tree>
I want to display children and ancestor node of tree branch incrementally.
1) If node with id=7 is selected, it childrens are displayed.
2) If node with 10 is selected, Nodes with id 10,9,8,7 are display. Node
With id=12 is not.
The template below appears to go some way to achieving this, however it
displays all nodes at once.
Would appreciate any help achieving my desired result.
<xsl:template match="tree_node">
<xsl:if test="parent::tree or ancestor::tree_node[@id=$id]">
<table width="100%">
<tr>
<td align="right" width="{count(ancestor-or-self::*) * 10}">
<a href="{$url}&node={@id}">+</a>
</td>
<td>
<xsl:value-of select="@value"/>
</td>
</tr>
</table>
<xsl:apply-templates/>
</xsl:if>
</xsl:template>
Cheers,
Adam
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








