Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 3rd, 2011, 01:38 AM
Registered User
 
Join Date: Aug 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default XML to CSV

Hello!!

I have the following XML file (exported from nessus) and I want to convert it to CSV format.


<?xml version="1.0" ?>
<NessusClientData_v2>
<Policy>
<policyName>all</policyName>
<policyComments></policyComments>
<Preferences>
<ServerPreferences>
<preference>
<name>max_simult_tcp_sessions</name>
<value>unlimited</value>
</preference>
</ServerPreferences>
<PluginsPreferences>
<item>
<pluginName>Hydra: PostgreSQL</pluginName>
<pluginId>18660</pluginId>
<fullName>Hydra: PostgreSQL[entry]:Database name (optional) :</fullName>
<preferenceName>Database name (optional) :</preferenceName>
<preferenceType>entry</preferenceType>
<preferenceValues></preferenceValues>
<selectedValue></selectedValue>
</item>
</PluginsPreferences>
</Preferences>
<FamilySelection>
<FamilyItem>
<FamilyName>MacOS X Local Security Checks</FamilyName>
<Status>enabled</Status>
</FamilyItem>
</IndividualPluginSelection>
</Policy>
<Report name="internal_all_nessus">
<ReportHost name="10.0.0.80"><HostProperties>
<tag name="HOST_END">Tue Jun 28 14:25:11 2011</tag>
<tag name="mac-address">00:15:f9:f8:b0:27</tag>
<tag name="host-ip">10.0.0.80</tag>
<tag name="host-fqdn">SIP0015F9F8B027.lan</tag>
<tag name="HOST_START">Tue Jun 28 14:20:24 2011</tag>
</HostProperties>
<ReportItem port="23" svc_name="telnet" protocol="tcp" severity="0" pluginID="0" pluginName="" pluginFamily=""/>
<ReportItem port="5060" svc_name="sip" protocol="udp" severity="1" pluginID="21642" pluginName="Session Initiation Protocol Detection" pluginFamily="Service detection">
<solution>If possible, filter incoming connections to the port so that it is
used by trusted sources only.</solution><risk_factor>None</risk_factor><description>The remote system is running software that speaks the Session
Initiation Protocol.

SIP is a messaging protocol to initiate communication sessions between
systems. It is a protocol used mostly in IP Telephony networks /
systems to setup, control and teardown sessions between two or more
systems.</description><plugin_publication_date>2003/12/29</plugin_publication_date><synopsis>The remote system is a SIP signaling device.</synopsis><plugin_type>remote</plugin_type><see_also>http://en.wikipedia.org/wiki/Session_Initiation_Protocol</see_also><plugin_modification_date>2011/03/07</plugin_modification_date><plugin_output>
The remote service was identified as :

Cisco-CP7960G/8.0

It supports the following options :

ACK,BYE,CANCEL,INVITE,NOTIFY,OPTIONS,REFER,REGISTE R,UPDATE
</plugin_output>
<plugin_version>$Revision: 1.18 $</plugin_version></ReportItem>
</ReportHost>
</Report>
</NessusClientData_v2>

The .csv must llok like this:

Host,Synopsis,Description,Solution,Risk Factor,PluginID
... ... ... ... ... .. ..

My main problem is that certain tags (the <Report item> tag) contain some attributes and I need to the "value" of the attributes in my .csv file. I am a bit confused since I am new with xsl but it is urgent for to accomplish the transformation as soon as posible.

Any help is welcome :)

Thank you





Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert XML to CSV with XML field names as column headers? swheeler XSLT 10 February 10th, 2012 11:18 AM
XML to CSV: Transformation asearle XML 0 March 19th, 2010 07:51 AM
CSV and XML with PHP NEO1976 PHP How-To 1 July 17th, 2006 02:33 AM
XML to CSV reloader2 XML 2 September 7th, 2005 08:51 AM
convert xml to csv woofy77 XSLT 0 December 8th, 2003 02:05 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.