XML make all Excel columns into attributes

I am doing a csv to xml transform. I want to make all of my csv row values attributes of EDT’s row element (which I have renamed to entry). The attached data.xml is my desired result; output.xml is what EDT gives me. Thank you.

data.transform (2.3 KB)
Conversion Data.csv (154 Bytes)
data.xml (566 Bytes)
output.xml (803 Bytes)

Here it is,

Simply load back the output as plain text and filter out the lines that you don’t need and save back as plain text with the xml extension.

Transform file.
data.transform (3.6 KB)

or you can do the following

Remove entry. from the Rename transform and put entry in the Row name field of To file xml output, also remove File comment (as that will match your desired output)

Transform file
data2.transform (2.0 KB)

2 Likes

Thank you very much. I definitely like the data2.transform better because it a true XML output.

By the way, here is how I did it with the original nested output that I posted via this XSLT stylesheet. Having an XSLT engine built into EDT would be incredible.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:math="http://www.w3.org/2005/xpath-functions/math"
    exclude-result-prefixes="xs math"
    version="3.0" expand-text="yes">
    
    <xsl:output indent="yes"/>
    
    <xsl:template match="/data">
        <xsl:copy>
            <xsl:copy-of select="entry/entry"/>
        </xsl:copy>
    </xsl:template>
    
</xsl:stylesheet>

Somewhere on the wishlist for v2. Probably couldn’t be done as a transform, as that would require tabular input and output. Possibly as an option when outputting XML to file?

That would be great if an XSLT transform could be specified on output to XML. And possibly when importing an XML file to EDT! Saxon is the gold standard XSLT engine; I am not sure what the licensing would be like to include it in EDT.

A current workaround is to invoke EDT via a command line and then invoke Saxon on the EDT output. I haven’t tried this yet, but it should work fine.

Before I found EDT, I would have to save an Excel file to CSV, then write an XSLT transform to parse the CSV and output to my desired XML output. This could result in some complex code that my clients usually couldn’t maintain. EDT has changed all that for sure.

1 Like