top of page

XML to CSV via XSLT

Writer's picture: Rumesh Aponso (RMAX)Rumesh Aponso (RMAX)

Updated: Nov 13, 2024

XML Content

 

<?xml version="1.0" encoding="ISO-8859-1" ?>
<data>
<line>"010000";"Grundstücke/Gebäude";"2023"</line>
<line>"017000";"Geb. im Bau (Anzahlungen)";"2023"</line>
<line>"020000";"Bet. Anlagen/Vorricht. &amp; Maschinen";"2023"</line>
<line>"025000";"Werkzeuge";"2023"</line>
<line>"030000";"Fahrzeuge/Transportmittel";"2023"</line>
<line>"040000";"BGA";"2023"</line>
<line>"050000";"Immatrielle Wirtschaftsgüter";"2023"</line>
</data>

  

XSLT - Transformer 

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
 
    <xsl:variable name='newline'><xsl:text>
</xsl:text></xsl:variable>
 
    <xsl:template match="/data">
<xsl:for-each select="./line">
<xsl:value-of select="concat(.,$newline)"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

CSV - Output 

"010000";"Grundstücke/Gebäude";"2023"
"017000";"Geb. im Bau (Anzahlungen)";"2023"
"020000";"Bet. Anlagen/Vorricht. & Maschinen";"2023"
"025000";"Werkzeuge";"2023"
"030000";"Fahrzeuge/Transportmittel";"2023"
"040000";"BGA";"2023"
"050000";"Immatrielle Wirtschaftsgüter";"2023"

Output:


5 views0 comments

Related Posts

See All

Fnd Dynamic Tab Page in IEE Client

[FndWindowRegistration("YVVDA_COMPANY_ADDR", "YvvdaCompanyAddr", FndWindowRegistrationFlags.HomePage)] [FndDynamicTabPage("frmCompanyAddr...

LISTAGG in PLSQL

Example 1: SELECT DISTINCT LISTAGG(t.commission_receiver, ';') WITHIN GROUP (ORDER BY t.commission_receiver) FROM...

Get Foundation Error from ORA Error

FUNCTION Strip_Ora_Error ( sqlerrm_        IN VARCHAR2,    sqlcode_        IN NUMBER DEFAULT NULL,    strip_ora_only_ IN BOOLEAN DEFAULT...

Comments


Copyright © 2025 RMAXOneNote

  • Online CV
  • LinkedIn
  • Youtube
  • GitHub
  • Blogger
bottom of page