Very confused on XML to XML conversion
Hi Gurus,
I've been trying to get my head around how to do this but no matter what I try, I'm not having any luck. I have cut down my source to attempt to clearly demonstrate what I am trying to do.
Here is my source...
<?xml version="1.0"?>
<node>
<node>
<node class="memory">
<capacity units="bytes">524288</capacity>
</node>
<node class="processor">
<capacity units="Hz">800000000</capacity>
</node>
</node>
</node>
and this is what I am trying to go to...
<?xml version="1.0"?>
<tbMachines>
<CpuSpeed units="MHz">800000</CpuSpeed>
<Memory>524288</Memory>
</tbMachines>
I can't work out how to choose the <node class="processor"> and put it's capacity in the <CpuSpeed> output node. I've tried templates and xsl:if 's but I always end up get the memory capacity instead. Any ideas would be much appreciated. Oh, and I would also like to divide the value of the capacity by a thousand if you happen to know the answer to that.
Thanks in advance,
Richard
Richard
|