I have the following XML file I am converting to csv, the problem is, the first data section is all string tags which I can skip if I need and the second section is a mix of string and int tags. i am able to get the data out, but there is a weird block of data on top i am unable to remove. The XML file is automatically generated so I cant change it.
<?xml version="1.0" encoding="utf-8"?>
<methodResponse><params><param><value>
<struct>
<member><name>columns</name><value>
<array><data>
<value><string>id</string></value>
<value><string>scanTime</string></value>
<value><string>host</string></value>
<value><string>vuln</string></value>
<value><string>port</string></value>
<value><string>protocol</string></value>
</data></array>
</value></member>
<member><name>table</name><value>
<array><data>
<value>
<array><data>
<value><int>1</int></value>
<value><int>1414010812</int></value>
<value><string>Host.5</string></value>
<value><string>Vuln.6230</string></value>
<value><int>500</int></value>
<value><string>udp</string></value>
</data></array>
</value>
<value>
</data></array>
</value></member>
</struct></value>
</param>
</params>
</methodResponse>
my XSL 1.0 code below
<xsl:variable name="new-line" select="'
'"/>
<xsl:output method="text" omit-xml-declaration="yes" indent="no"/>
<xsl:template match="value/array/data">
<xsl:for-each select="//array/data">
<xsl:for-each select="value">
<xsl:value-of select="translate(*, $new-line,' ')"/>,
</xsl:for-each><br/>;
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
my desired output
id,scanTime,host,vuln,port,protocol
1,1414010812,Host.5,Vuln.6230,500,udp;
2,1414010978,Host.6,Vuln.1191,22,tcp;
3,1414010978,Host.6,Vuln.30535,22,tcp;
4,1414010978,Host.6,Vuln.78682,22,tcp;
5,1414010978,Host.6,Vuln.78683,22,tcp;
The problem is that it runs through the process and prints everything on one line with huge spaces before it prints my desired output.
I have read the best practices for posting, however this is my first post so feel free leave any solid feedback for posting etiquette. Thank you
