XSLT to parse Cenzic Hailstorm XML

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<pre class="prettyprint <?xml version="1.0" encoding="utf-8" ?>
- <Assessments>
- <AssessmentRunData RequestId="" AssessmentRunId="aacd295a-7d4c-4363-92e3-cd84fbe9b08b
- <SmartAttacks>
- <SmartAttacksData>
- <SmartAttackInfo>
<SmartAttackName>File & Directory Discovery - [OWASP 2010 A 8]</SmartAttackName>
<Description>...this is the description...</Description>
<HowItWorks>...this is how it works...</HowItWorks>
<Impact>...</Impact>
<Remediation>...</Remediation>
</SmartAttackInfo>
- <ReportItems>
- <ReportItem Id="2358
<ReportItemType>Information</ReportItemType>
<ReportItemCreateDate>6/22/2012 12:26:23 PM</ReportItemCreateDate>
<Severity>Low</Severity>
<HarmScore>81</HarmScore>
<Count>1</Count>
<Message>...This is the message</Message>
<URL />
</ReportItem>
</ReportItems>
- <Categories>
- <Category>
<Name>OWASP-2010</Name>
</Category>
</Categories>
</SmartAttacksData>
</SmartAttacks>
<ASMSummaryData />
</AssessmentRunData>[/code]
Im trying to parse Cenzic Hailstorm XML results into a single table. I cant figure out the XSLT syntax to pull data from both the <SmartAttackInfo> and <ReportItems>, and put inside a multi-column table.

Heres my desired output:
Tablename: <br/>
tblReportItems
Fields:
SmartAttackName = Assessments/AssessmentRunData/SmartAttacks/SmartAttackData/SmartAttackInfo/SmartAttackName ReportItemType = Assessments/AssessmentRunData/SmartAttacks/SmartAttackData/ReportItems/ReportItemType ReportItemCreateDate = Assessments/AssessmentRunData/SmartAttacks/SmartAttackData/ReportItems/ReportItemCreateDate
Severity = Assessments/AssessmentRunData/SmartAttacks/SmartAttackData/ReportItems/Severity HarmScore = Assessments/AssessmentRunData/SmartAttacks/SmartAttackData/ReportItems/HarmScore
<br/>
Count = Assessments/AssessmentRunData/SmartAttacks/SmartAttackData/ReportItems/Count Message = Assessments/AssessmentRunData/SmartAttacks/SmartAttackData/ReportItems/Message URL = Assessments/AssessmentRunData/SmartAttacks/SmartAttackData/ReportItems/URL

I think I need to use apply-templates, but I dont understand how to wrap it into a table output. <hr class="sig Steve Clark, MCTS | Twin-Soft.com Twin-Soft.com <br/>
http://www.easy-bins.com Easy Bins Dumpster Rentals of Northern VA. (Specializing in driveway-sized roll-off dumpsters.)<br/>
<i>Be sure to click one of them there forum buttons that artificially inflates my narcissitic ego... I mean gives me points.</i>

View the full article
 
Back
Top