Wednesday, 2 July 2014

Applying Styling to Dynamic XML



I am new to XML and XSL stuff Created an XML and its contents can be dynamic i.e. in some cases some of elements may not be present and I want to output it as HTML table , how can I write such an XSL ?


Sample XML , in some cases Configuration Element may not be present entirely ,



<Stat>
<Name></Name>
<Hardware></Hardware>
<Software></Version>
<Version></Version>
<State></State>
</Stat>
<Configuration>
<Up>
<Option1>2000</Option1>
<Option2>2500000</Option2>
<Option3>0</Option3>
<Option4>0</Option4>
<Option5>NA</Option5>
</Uplink>
<Down>
<Option1>2000</Option1>
<Option2>2500000</Option2>
<Option3>0</Option3>
<Option4>0</Option4>
<Option5>NA</Option5>
</Down>
</Configuration>


Expected Output: HTML table with row and col span , does some kind of recursive solution possible which automatically goes to each XML elemnt and put it in table header and picking corrsponding value ?


No comments:

Post a Comment