[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Need help to flatten and regroup data

Subject: Need help to flatten and regroup data
From: "Yang, Siew-Hong" <siew-hong.yang@xxxxxx>
Date: Mon, 24 May 2004 13:37:15 -0400
xpath flatten
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.