Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display XML data as a table using CSS?

Tags:

css

xml

I have the below code. I want to link the XML code to a style sheet, and display the data in a table. I have linked to the style sheet but how do I display the XML data in a table?

<!DOCTYPE products SYSTEM "support.dtd">
<?xml-stylesheet href="style.css"?>

<products>
  <product>Widows XP</product>
  <product>Windows Vista</product>
  <product>Windows 7</product>
  <product>Windows Server 2003</product>
  <product>Windows Server 2008</product>
  <product>Debian Linux</product>
  <product>RedHat Linux</product>
  <product>VMware Virtulization</product>
  <product>Microsoft Hyper-V</product>
</products>
like image 591
Jon Avatar asked Feb 01 '12 05:02

Jon


1 Answers

To display the given data in a table, use

products { display: table; }
product { display: table-cell; }

This displays the data as a one-row table. To add borders around cells, for example, add

product { border: solid 1px; }
like image 86
Jukka K. Korpela Avatar answered Oct 16 '22 20:10

Jukka K. Korpela