Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6166715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:23:05+00:00 2026-05-23T22:23:05+00:00

I wonder if somebody can help me flatten an XML file to CSV format.

  • 0

I wonder if somebody can help me flatten an XML file to CSV format. I have worked on this all day today, and although I’ve found some simple examples, my issue is slighlty different. Please see example below…

Example XML:

<data>
    <val_A>1</val_A>
    <val_A>2</val_A>
    <val_B>3</val_B>
    <val_B>4</val_B>
    <val_C>
        <val_D>5</val_D>
        <val_D>6</val_D>
    </val_C>
    <val_E>
        <val_F>7</val_F>
        <val_F>8</val_F>
    </val_E>
</data>

Expected Output:

val_A,val_B,val_C,val_D,val_E,val_F
1,3,,5,,7
1,3,,5,,8
1,3,,6,,7
1,3,,6,,8
1,4,,5,,7
1,4,,5,,8
1,4,,6,,7
1,4,,6,,8
2,3,,5,,7
2,3,,5,,8
2,3,,6,,7
2,3,,6,,8
2,4,,5,,7
2,4,,5,,8
2,4,,6,,7
2,4,,6,,8

Notice that the data node has several different structure of child node. Is it possible to write XSL to flatten this?

Second question is it possible to write the XSL in a generic way so that it doesn’t need to be aware of node names and therefore just works for any XML fed in?

Any help would be greatly appreciated.

Thanks
David

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T22:23:06+00:00Added an answer on May 23, 2026 at 10:23 pm

    ALthough not an XSL-based soltution, in order to flatten the XML file into CSV you could look into the open source project XMLtoCSV available at here. It can do the job without having to specify the xml node names, as requested.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Wonder if anyone can help me with this problem. I have created a Window
wonder whether someone can help me with the following one... I have a struct
wonder if anyone can help; I have an a two dimensional array which I
Wonder if you can help for Christmas. I am trying to read an XML
Wonder if anyone can help me. I have a setup whereby a main menu
Wonder if anyone can help me understand how to sum up the column of
wonder if someone can help me i know what i want to achive but
Wonder if anyone can help me, the map displays fine but the marker does.
wonder if anyone can help. Bascially I'm working on a site, and a chunk
I wonder if somebody would be kind enough to help me with my query?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.