This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Needed traversing code for ......


I have an xml like this- 

 <kwd name="kwd name 1" kwd_group="kwd group 1" interest="interest1, interest2"> 
 <item name="item name 1" item_group="item group 1"> 
 <ctg ctg_no="category no" desc="description1"> 
  <ctg ctg_no="category no" desc="description2" url_full="url full 2" url_complete="Y" /> 
  </ctg> 
  <ctg ctg_no="category no" desc="description3" url_full="url full 3" url_complete="Y" /> 
 <ctg ctg_no="category no" desc="description4"> 
  <ctg ctg_no="category no" desc="description5" url_full="url full 5" url_complete="Y" /> 
  <ctg ctg_no="category no" desc="description6" url_full="url full 6" url_complete="Y" /> 
 <ctg ctg_no="category no" desc="3rd level"> 
  <ctg ctg_no="category no" desc="3rd level description1" url_full="url full 7" url_complete="Y" /> 
  <ctg ctg_no="category no" desc="3rd level description2" url_full="url full 7" url_complete="Y" /> 
  </ctg> 
  </ctg> 
  </item> 
 <item name="item name 2" item_group="item group 2"> 
  <ctg ctg_no="category no" desc="description8" url_full="url full 8" url_complete="Y" /> 
 <ctg ctg_no="category no" desc="description9"> 
  <ctg ctg_no="category no" desc="description10" url_full="url full 10" url_complete="Y" /> 
  </ctg> 
  <ctg ctg_no="category no" desc="description11" url_full="url full 11" url_complete="Y" /> 
  </item> 
  </kwd> 

My Requirement: 

I need xsl code which will travel through the above nesting and apply the template (for eg <li id = YYYY> </li>). 

template for level one should be like this
<li id = top1>   --- [ added for clarity LEVEL 1 ] 
</li> 

template for level two should be like this
<some thing>
<li id = top2>  --- [ added for clarity LEVEL 2 ] 
</li> 
<something>

template for level three should be like this
<some thing>

<li id = top3> --- [ added for clarity LEVEL 3 ] 
</li> 

<some thing>



Basically the the o/p structure should be like this 
kwd 
   - itemname 1 
       - ctg no description 1  --- [ added for clarity LEVEL 1 ] 
            description 2 
        description 3 
        - ctg no description 4 - --- [ added for clarity LEVEL 2 ] 
             description 5 
             description 6 
            -  ctg no 3rd level   - --- [ added for clarity LEVEL 3 ] 
                  3rd level description 1 
                  3rd level description 2 


Could u Please help. 

thanks in Advance 
Venkatesh 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]