Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - E-learning website with XML/XSL [Thread Next] Re: E-learning website with XML/XSLTo: NULL Date: 4/5/2009 1:48:00 PM pradeep wrote: > My task is to create an e-learning website using XML/XSL. Below you > can see the main structure of my xml file. The root element is > 'elearning'. It contains many courses. Each course have a small > summary, an agenda, and chapters. The sub-element 'chapters' contain > many 'chapter' elements. > > Now the part which I wanted to achieve and thats what I want to know > from you guys, is that the whole course should be divided into many > pages. First page should contain the elements from summary, second > page with agenda (like shown below in a table), and rest of the pages > with contents and exercises from each chapter. Each page should > somehow only display 'part' of this main.xml. And I should be able to > also navigate through pages using 'Previous' and 'Next' links. > > Is it possible with just one XSL file? Yes, in several ways. a) XSLT2 allows you to create multiple output files from a single input file, so you could create the site statically in this way and upload it to your web site. b) You could also do this with XSLT 1.0, by running your processor multiple times on the same input file, and setting a variable (under script control) to emit the right HTML file each time. c) If you use an XML server like Cocoon, then the HTML gets created dynamically and you don't have to upload anything or worry about directory organisation. The HTML is cached so that it gets re-served if the master file hasn't changed. If the master file is updated, new pages are served immediately: there is nothing to generate or upload. (a) and (b) are simpler to set up, but require more management. (c) needs a little more programming but it much easier to run. > Or one for summary, one for agenda and one for displaying chapters? I'd either stick to one XSL file, or apply a rigorous modularisation so that you avoid duplication. It depends on the complexity and the volume, and on how much dead-weight (banners, sidebars, menus, advertising, etc) gets created along with the actual content for each page. > If so how could I include many xsl files in the main.xml? ***DO NOT*** try to use client-side XSLT for anything beyond the truly trivial. Browsers do not implement XSLT correctly, nor do they implement all of it, and the speed of client-side XSLT is too slow for normal use. Do the work on the server, where you can control what happens, and where you can keep the source of your documents and scripts under your control. > After writing all these, I also think I'm asking too much. No, I think you're on exactly the right track, but don't even think of trying to do this with client-side XSLT. > Agenda page > ----------------------------------------------------------------------------------------------------------------- > | Week | Theory | > Lab | > | 1 | XML-Talk First Contact | XML Playing around, Hallo > World | > | 2 | XML-Intro, XML-DTD | Question-Answer, Halloworld- > XML, Book | > ----------------------------------------------------------------------------------------------------------------- Don't use lines over 79 characters long in fixed-width character mode in Usenet posts...they get broken up. And don't use a proportional-space font when writing formatted diagrams, because other people won't have the same font. I *think* you mean: > Agenda page > ------------------------------------------------------------------- > |Week|Theory |Lab | | | | | > | 1 |XML-Talk First Contact|XML Playing Around, Hallo World | > | | | | > | 2 |XML-Intro, XML-DTD |Question-Answer, Halloworld-XML, Book| > ------------------------------------------------------------------- Generating this from the XML is not difficult, but there are some simple tricks in designing your XML document type to make things easier. 1. Use a public and well-known Schema or DTD if one exists, instead of inventing your own. It will make your work more acceptable in the community, and make it *much* easier to use existing tools like editors, servers, and formatters. 2. Use the ID/IDREF feature of XML to make your links more robust. In your existing example, <agenda> <week nr="1" chapters="1"/> <week nr="2" chapters="2,3"/> </agenda> would be MUCH more robust using IDs for the chapters and IDREFS for the links to them. This lets you reorganise your design without having to worry about numbering. <agenda> <week nr="1" chapters="firstcontact"/> <week nr="2" chapters="intro dtds"/> </agenda> ... <chapter id="firstcontact"> ... <chapter id="intro"> ... <chapter id="dtds"> NEVER hard-code numbering sequences unless you are recording or transcribing an existing sequence from elsewhere. 3. Don't use attributes called "id" which are not XML IDs (must start with a letter). It is misleading to other people using the document. 4. NEVER use culturally-formatted dates for storage (09.01.2009). This could be either September 1st or January 9th! ALWAYS use ISO date format (2009-01-09) because it is unambiguous (and sortable). 5. Do read about the current practice of e-learning content creation. A good start is "E-learning Standards" by Fallon & Brown (CRC, 2003; 1574443453). ///Peter -- XML FAQ: http://xml.silmaril.ie/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
