The purpose of this page (http://tecfa.unige.ch/~ott/xml/agenda/agenda.php) is to comment a small xml/cocoon-project I work on from time to time to learn xml & stuff.
The agenda project has nothing really spectacular in itself. I started the project to play around with the technology. The basic idea is to build a diary/agenda thing...
Why not have a look at the (under_continuous_construction) web page, i.e. agenda.sxml ?
But why the .sxml extension (and not .xml as it usually is)? Answer: Because our cocoon configuration recognizes the .sxml extension and not the .xml extension. It is the TECFA's webmaster temporary(?) choice.
3 files are implicated in the agenda project. Hereafter you'll find some comments and the up to the moment source code for each one of the following files:
|
agenda.sxml <?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE agenda SYSTEM "agenda.dtd" > <?cocoon-process type="xslt" ?> <?xml-stylesheet href="agenda.xsl" type="text/xsl" ?> <agenda context="DAO.STUFF"> <event submission-time="18:00:00" submission-date="07-07-2000"> <title>Dao's first xml-dtd</title> <description>Just finished my agenda dtd... next step will be to produce an XSLT file.</description> <submitter>dao</submitter> </event> <event submission-time="19:00:00" submission-date="07-07-2000"> <title>First XSLT</title> <description>Finished my first XSLT and you're looking at it.</description> <submitter>dao</submitter> </event> <event submission-time="19:00:00" submission-date="08-07-2000"> <title>xsl:for-each</title> <description>My first xsl:for-each replaces an xsl:apply-template.</description> <submitter>dao</submitter> </event> <event submission-time="23:31:00" submission-date="11-07-2000"> <title>le test va être fait</title> <description>voilà, si ca a foiré élémentairement</description> <submitter>ôlivié clâvèle</submitter> </event> </agenda> |
|
agenda.dtd <?xml version="1.0" encoding="ISO-8859-1" ?><!ENTITY % agendainfo ' context NMTOKEN #REQUIRED '> <!ENTITY % timeinfo ' start-date NMTOKEN #IMPLIED end-date NMTOKEN #IMPLIED submission-date NMTOKEN #REQUIRED submission-time NMTOKEN #REQUIRED '> <!ELEMENT agenda (event*)> <!ATTLIST agenda %agendainfo;> <!ELEMENT event (title,description,submitter,place?)> <!ATTLIST event %timeinfo;> <!ELEMENT title (#PCDATA)> <!ELEMENT description (#PCDATA)> <!ELEMENT submitter (#PCDATA)> <!ELEMENT place (#PCDATA)> |
|
agenda.xsl <?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <head> <style> h1 { color:red; font-weight:bold; background-color:green; } </style> </head> <xsl:apply-templates/> </html> </xsl:template> <xsl:template match="agenda"> <body> <h1> <xsl:value-of select="./@context"/> </h1> <xsl:for-each select="event"> <p> <small> [by:<xsl:value-of select="submitter"/> / <xsl:value-of select="./@submission-time"/> / <xsl:value-of select="./@submission-date"/>] </small> <br/> <strong> <xsl:value-of select="title"/> </strong> <br/> <xsl:value-of select="description"/><br/> </p> </xsl:for-each> </body> </xsl:template> </xsl:stylesheet> |