Hi,
Being new to XSLT and XPATH, I am having a very difficult time to
reformat the following XML data using XSLT1.0 and XPATH. Read through
FAQ and etc and didn't quite see exactly the same problem.
--
<Node>
<name="systemA"/>
<metric>
<group type="Double" />
<name="APP_CPU_TOTAL_TIME" />
<ns:dataSample>
<ns:data />
<ns:time />
</ns:dataSample>
<ns:dataSample>
..
</ns:dataSample>
...
</metric>
<metric>
..
<metric />
<metric>
<group type="Integer" />
<name="APP_MEM_VIRT" />
<ns:dataSample>
<ns:data />
<ns:time />
</ns:dataSample>
<ns:dataSample>
..
</ns:dataSample>
...
<metric/>
<metric>
..
</metric>
<metric>
<group type="String" />
<name='APP_NAME'>
<ns:dataSample>
<ns:data>
<ns:time>
</ns:dataSample>
<ns:dataSample>
..
</ns:dataSample>
...
</metric>
...
</Node>
<Node>
..
</Node>
---
to the following XML output
---
<Records>
<NodeName> <!-- from node/name>
<CpuTime> <!--- from ns:data when
metric/name="APP_CPU_TOTAL_TIME" for the same ns:time and node-->
<MemUsed> <!---from ns:data when metric/name="APP_MEM_VIRT" for
the same ns:time and node--->
<DataTime> <!---from ns:time -->
<AppName> <!---from ns:data when metric/name="APP_NAME" for the
same ns:time and node--->
</Records>
--
I flatten the data but then I could not get anything else going. In
particular, I could not make XSLT to use template that tries to match
anything NOT in the "ns:" nodes. Examples, I could not get <template
match="//Node"> or <template match="//metric">to work....
I declared the namespaces at the beginning of the style sheet.
I'd greatly appreciate any advice anybody can offer.
Thanks
Siew