I need to write generic xsl that would take in an xml document and output the count of nodes and their names. So if I have a file like the following:
<assets>
<asset>
<type>hardware</type>
<item>
<name>HP laptop</name>
<value>799</value>
</item>
<item>
<name>server</name>
<value>1000</value>
</item>
<item>
<name>ViewSonic Monitor</name>
<value>399</value>
</item>
</asset>
<asset>
<type>software</type>
<item>
<name>Windows Vista</name>
<value>399</value>
</item>
<item>
<name>Office XP</name>
<value>499</value>
</item>
<item>
<name>Windows 7</name>
<value>399</value>
</item>
<item>
<name>MS Project Professional 2007</name>
<value>299</value>
</item>
</asset>
</assets>
The output would be:
<output>
<node name="assets" count="1"/>
<node name="asset" count="2"/>
<node name= "type" count="??"/>
<node name="item" count=??/>
<node name="name" count=??/>
<node name="value" count=??/>
</output>