PDA

View Full Version : Tables in XML


lady_weaver
09-26-2005, 02:21 PM
Is it possible to do tables using xml or does the information have to come from a linked style sheet???????
Can any one point me in the right direction for information on how to do this????

KC-Luck
09-26-2005, 03:40 PM
xml can be of any data structures you require. as long as you keep it "well-formed."

the magic is how you wish to render it:

DOM, XSL, or CSS

Is it possible to do tables using xml
are you speaking of HTML rendered tables to a browser?

lady_weaver
09-27-2005, 04:16 AM
I am to make a table with data in it using xml and having a link within the xml, which I am using notepad to write, that connects it to the css used for this particular WebPage. The data is simple like, bananas $1.34/kg, pears 1.29/kg etc. but in a table or block format? Do you know how to do this? I think I am suppose to write a code in css to make a block but I don't know how this is done. Regards Kym

Alex Vincent
09-27-2005, 05:57 AM
lady_weaver: I can send you a sample file if you wish; but in the short term, take a look at this:

http://www.w3.org/TR/1998/REC-CSS2-19980512/tables.html#q2

KC-Luck
09-27-2005, 03:50 PM
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="data-table.css"?>
<data>
<item>
<name>Pear</name>
<price>$1.37</price>
<desc>A pear is delicious</desc>
</item>
<item>
<name>Apple</name>
<price>$2.07</price>
<desc>Yummy red apples</desc>
</item>
</data>

item {display:block;}
price {color:blue;}
desc {display:block;margin-left:15px;color:#666;}

lady_weaver
09-28-2005, 07:08 AM
Thank you Alex Vincent and KC-Luck for your help with this xml. I am finding things a little difficult. I have only learnt how to use forums this last week. I am afraid I am very green at this.
Alex Vincent: I would apprecite a sample file if you wouldn't mind. I feel in everything there is something I dont know. I am learning a lot and it is quick so I want to remember it all. Thanks, I will look at the site that you have made reference to.

KC-LUCK: Thank you for the code. As soon as I have tried it I will let you know how it went.

Thank you both very much for your help.
Regards
Kymberly

lady_weaver01@yahoo.com

gsnedders
09-28-2005, 03:17 PM
Here's a simple sample code using what Alex was talking about:

XML: (this is just KC-Luck's code)
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="data-table.css"?>
<data>
<item>
<name>Pear</name>
<price>$1.37</price>
<desc>A pear is delicious</desc>
</item>
<item>
<name>Apple</name>
<price>$2.07</price>
<desc>Yummy red apples</desc>
</item>
</data>

data-table.css:
data {
display: table;
}
item {
display: table-row;
}
name, price, desc {
display: table-cell;
}

So, now the browser is rendering it as a table, but with absolutely no other styling.