XML to CSV



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 will be 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"

.



Relevant Pages

  • Re: [XSLT] Performance issue
    ... issue with xslt. ... just selecting direct children of the root node of each file). ... My problem is that my catalog file has more than 100,000 elements. ... Without such an extension the XSLT spec more or less force the processors to hold your documents in memory as they need to guarantee that you get the same doument back if you call documenttwice on the same URI, even if it has changed on the server during the process. ...
    (comp.text.xml)
  • Re: Using Custom XSLT in Message Construction Shape
    ... There are limitiations in Matts technique, ... XSLT i.e the root node and 2 nodes, ... If your XSLT is self contained, ... Create a map - specify the input and output schemas ...
    (microsoft.public.biztalk.general)
  • Re: Using variables to select nodes by attribute for an XSLT template
    ... I found the problem...the variable $selcategory wasn't ... being set correctly because the root node wasn't being matched ... The XSLT should be: ...
    (microsoft.public.dotnet.xml)
  • RE: XmlDocument xsi: Problem
    ... I would like to confirm my understanding of your issue. ... I understand that you need to create a root node like ... Prev by Date: ...
    (microsoft.public.dotnet.xml)
  • Re: Error while receiving XML envelope document
    ... BodyXPATH variable held against the root node in the envelope. ... sure it points to the correct node. ... the body xpath should be set to (zoom in on this field to get ... Prev by Date: ...
    (microsoft.public.biztalk.general)