Subject: Re: [xsl] Flat XML: Problem getting children From: Anton Triest <anton@xxxxxxxx> Date: Thu, 07 Oct 2004 19:51:24 +0200 |
I have an xml file that has the following structure:Hi Jacqui,
<thesaurus>
<concept>
<descriptor>House</descriptor>
<NT>Rooms</NT>
<NT>Roofs</NT>
<SN>All About houses</SN>
</concept>
<concept>
<descriptor>Rooms</descriptor>
<BT>House</BT>
<NT>Lounge</NT>
<NT>Kitchen</NT>
<SN>We have rooms in houses</SN>
</concept>
<concept>
<descriptor> Lounge </descriptor>
<BT> Rooms </BT>
<SN>Lounges are nice places</SN>
</concept>
<concept>
<descriptor> Roofs </descriptor>
<BT>House</BT>
<NT>Kitchen</NT>
<SN>Roofs go on houses</SN>
</concept>
<concept>
<descriptor> Utensils </descriptor>
<BT>Kitchen</BT>
<SN>Utensils belong in the draw</SN>
</concept>
</thesaurus>
NT - the children categoriesOne of these is redundant, you can ignore the <BT> elements if you work from top to bottom:
BT - the parent category
<result> <concept name="House"> <concept name="Rooms"> <concept name="Lounge"/> <concept name="Kitchen"> <concept name="Utensils"/> </concept> </concept> <concept name="Roofs"> <concept name="Kitchen"> <concept name="Utensils"/> </concept> </concept> </concept> </result>
Cheers, Anton
The objective is to create a expandable client side tree structure, and the user will click on a category and the category information (SN) will be displayed in the right frame.
- HOUSE - Rooms o Lounge o Kitchen ' Utensils - Roofs o Kitchen ' Utensils
I can get the top level categories: <xsl:for-each select="thesaurus/concept[boolean(BT)=false]">
My problem is I do not know how to get the children and their children etc. (loop until the concept has no NT element) . There is no limit to the number of children levels and a child can appear in more than one parent. I think I need to use a key but am not having ANY success.
Thanks in advance!!
Jacqui
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Flat XML: Problem gettin, Michael Kay | Thread | [xsl] Namespace Problem, Bommineni, Venkatesh |
RE: [xsl] Flat XML: Problem gettin, Michael Kay | Date | [xsl] Namespace Problem, Bommineni, Venkatesh |
Month |