[xsl] changing node names in XML

Subject: [xsl] changing node names in XML
From: Vijay Mummaneni <vijaya.mummaneni@xxxxxxx>
Date: Fri, 25 Oct 2002 10:12:37 -0700
Hi,

I need to change the node names in my XML file based on a condition.
If a an element has children then the element name has to become
"folder",
and if an element has no children then its name has to become "leaf".
For example :

<Employees>
       <employee name="emp5" id="5">
              <employee name="emp2" id="2">
                     <employee name="emp1" id="1"/>
                     <employee name="emp4" id="4"/>
            </employee>
            <employee name="emp3" id="3"/>
       </employee>
</Employees>


As :

<Employees>
       <folder  name="emp5" id="5">
              <folder  name="emp2" id="2">
                     <leaf  name="emp1" id="1"/>
                     <leaf  name="emp4" id="4"/>
            </folder>
            <leaf  name="emp3" id="3"/>
       </folder>
</Employees>

I wanted to use XSLT. Do you have a hint how can I achieve that ?

Thanks
vijay



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


Current Thread