|
-
Feb 15th, 2006, 04:13 AM
#1
Thread Starter
PowerPoster
Styling XML...
Hmm, well, just finished fixing my XML to HTML script in PHP, and now I figure I may as well find out if I've wasted my time.
I'm trying to display an XML timetable,
http://www.pcmstudios.com/uni/timetable.php
As that.
The XML can be found here,
http://www.pcmstudios.com/uni/timetabledata/pjmcc.xml
Obviously I can change the structure of the XML as needed... but can I style it to make it look like a table with having to loose the readability of the XML document? (well, it was readable in the beginning, this rewrite has screwed that up abit)
Thanks inadvance.
-
Feb 17th, 2006, 05:48 AM
#2
Re: Styling XML...
Off the top of my head I'm not entirely sure how you'd display XML elements as columns, so I think it would be easiest if in the XML you defined the rows instead. Then you could display it quite easily using a CSS 2 table. It would however probably mean that your XML markup would be longer, so if what you've got now works I suggest stick with it. Either that, or you could try making an XSL transformation script... but that would not really have any advantage over the PHP in this particular case, only if you wanted to display the XML independently using a browser only.
-
Feb 19th, 2006, 06:08 AM
#3
Re: Styling XML...
Of course it's possible. You only need to add a reference to an XSL file in your XML file. So the readability is maintained to code.
You'd most likely need to pay attention to for-each in XSL.
http://www.w3schools.com/xsl/xsl_for_each.asp
-
Feb 22nd, 2006, 03:55 AM
#4
Thread Starter
PowerPoster
Re: Styling XML...
 Originally Posted by mendhak
Of course it's possible. You only need to add a reference to an XSL file in your XML file. So the readability is maintained to code.
You'd most likely need to pay attention to for-each in XSL.
http://www.w3schools.com/xsl/xsl_for_each.asp
Aren't they out of order? Consider HTML works by Row while the XML file is by Day? (aka Column)
Just curious about the power of XML... can I get it to calculate the number of days to go till a certain Day? Trying to do an assignment list and there due dates, and in the PHP version I had a days to go field, as well as being able to change the rows colour once the day had passed, so would be great if I could include that feature as well.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|