W3C home > Mailing lists > Public > xsl-editors@w3.org > October to December 2005

XML to CSV

From: Serena Phan <serena.phan@hotmail.com>
Date: Tue, 22 Nov 2005 02:07:44 +0000
Message-ID: <BAY17-F31D2E2EDABA7F3CBDD8501F8520@phx.gbl>
To: xsl-editors@w3.org

Hi,

I'm just wondering if it is possible to get the output below by using xslt. 
I can get solve the problem in which only one of the children of the root 
node has a subtree (i.e only <b> has children) but not the case where <c> 
and <d> have children as well.

Any advice is greatly appreciated.

Thanks.

Input:

<?xml version="1.0" encoding="UTF-8"?>
<root>
	<a>a</a>
	<b>
		<bb>bb1</bb>
		<bb>bb2</bb>
		<bb>bb3</bb>
		<bb>bb4</bb>
	</b>
	<c>
		<cc>
			<ccc>ccc1</ccc>
		</cc>
		<cc>
			<ccc>ccc2</ccc>
		</cc>
	</c>
	<d>
		<dd>dd1</dd>
		<dd>dd2</dd>
	</d>
</root>

Output:

"a",	"bb1",	"ccc1",	"dd1"
"a",	"bb2",	"ccc1",	"dd1"
"a",	"bb3",	"ccc1",	"dd1"
"a",	"bb4",	"ccc1",	"dd1"
"a",	"bb1",	"ccc2",	"dd1"
"a",	"bb2",	"ccc2",	"dd1"
"a",	"bb3",	"ccc2",	"dd1"
"a",	"bb4",	"ccc2",	"dd1"
"a",	"bb1",	"ccc1",	"dd2"
"a",	"bb2",	"ccc1",	"dd2"
"a",	"bb3",	"ccc1",	"dd2"
"a",	"bb4",	"ccc1",	"dd2"
"a",	"bb1",	"ccc2",	"dd2"
"a",	"bb2",	"ccc2",	"dd2"
"a",	"bb3",	"ccc2",	"dd2"
"a",	"bb4",	"ccc2",	"dd2"

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! 
http://search.msn.com/
Received on Tuesday, 22 November 2005 15:06:18 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:59:58 GMT