E-learning website with XML/XSL

P

pradeep

The below post I have also posted in a different group (XSLT), but
didn't get any reply yet, thought I would also post it in this group.
I hope this is appropriate.

Hello Everyone

First of all I should say that I just started working with XML-XSL. So
please forgive me if I'm asking too much for a newbie.

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? Or one for summary, one for
agenda and one for displaying chapters? If so how could I include many
xsl files in the main.xml?

After writing all these, I also think I'm asking too much. I hope I
have explained clearly. Otherwise please ask me. Could someone help
me? I would be very thankful.

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 |
---------------------------------------------------------------------------­--------------------------------------

XML (main.xml)
---------------------------------------------------------------------------­-----------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="xml.xsl"?>
<elearning>
<course id="1" category="programming">

<summary>
<title>XML Tutorial</title>
<class>ST2009</class>
<start-date>09.01.2009</start-date>
<day>Friday</day>
<time>08:15-10:45</time>
<prerequisites>Experience with a programming or scripting language,
such as Java, JavaScript, VB, C++, Java or C# is helpful but not
necessary.</prerequisites>
<url>http://web.test.ch/personalweb/pradeep/xml/</url>
</summary>

<agenda>
<week nr="1" chapters="1"/>
<week nr="2" chapters="2,3"/>
</agenda>

<chapters>
<chapter nr="1">
<title>XML-Talk First Contact</title>
<content>g dsgsdgsd gf dsgsdfg dfgsd fgs dgfs dfg sdfg sdfg sdfgsg</
content>
<exercise link="xml-talk.zip">XML Playing around</exercise>
<goal>Understand how the XML auction is working! this is really
enough! How the data are stored? How the presentation is done? How the
control is working?</goal>
</chapter>
<chapter nr="2">
<title>XML-Intro</title>
<content>f asfas fasdf saf as fsaf saffas fsafsf</content>
<exercise link="Exercice%202.mht">Fragen-Antwort</exercise>
<exercise link="Hallo.xml">Hallo World</exercise>
<goal>Understand the advantages and disadvantage of XML. Be able to
realize your first XML document. Understand the differents parts of an
XML document!</goal>
</chapter>
<chapter nr="3">
<title>XML-DTD</title>
<content>vbvcbvbnvbnvbncvnncvbnn nn cvnc vnb
cvnnvbvcbvbnvbnvbncvnncvbnn</content>
<exercise link="hello_xml_xsl.mht">Halloworld-XML</exercise>
<exercise link="book.xml">Book</exercise>
<goal>Understand DTD</goal>
</chapter>
<!-- further chapters -->
</chapters>
</course>
<!-- further courses -->
</elearning>
 
P

Peter Flynn

pradeep said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top