Hoe wordt die door Smarty gegenereerd?
Handmatig misschien?
XML is niet veel anders, als het wordt geassocieerd met een XSLT stylesheet. Deze zet het om naar een ander formaat, bijv. HTML.
info.xml
CODE
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="info.xsl"?>
<links>
<categories>
<category id="0" name="XML">
<link id="0">
<description>Xerces2-J Libraries</description>
<version>2.6.2</version>
<location>http://xml.apache.org/xerces2-j/index.html</location>
<directlocation>http://www.apache.org/dist/xml/xerces-j/Xerces-J-bin.2.6.2.zip</directlocation>
</link>
<link id="1">
<description>Xerces2-J Tools</description>
<version>2.6.2</version>
<location>http://xml.apache.org/xerces2-j/index.html</location>
<directlocation>http://www.apache.org/dist/xml/xerces-j/Xerces-J-tools.2.6.2.zip</directlocation>
</link>
<link id="3">
<description>Sun's XML introduction</description>
<version>0</version>
<location>http://java.sun.com/xml/index.jsp</location>
<directlocation>http://java.sun.com/xml/tutorial_intro.html</directlocation>
</link>
<link id="4">
<description>W3C's XML tutorial</description>
<version>0</version>
<location>http://www.w3schools.com/xml/default.asp</location>
<directlocation>http://www.w3schools.com/xml/xml_whatis.asp</directlocation>
</link>
<link id="5">
<description>W3C's DOM tutorial</description>
<version>0</version>
<location>http://www.w3schools.com/dom/default.asp</location>
<directlocation>http://www.w3schools.com/dom/dom_intro.asp</directlocation>
</link>
</category>
<category id="1" name="GUI (Swing)">
<link id="6">
<description>SwiXML Libraries</description>
<version>1.1-139</version>
<location>http://www.swixml.org/</location>
<directlocation>http://www.swixml.org/swixml_139.zip</directlocation>
</link>
<link id="7">
<description>SwiXML Examples</description>
<version>1.1-139</version>
<location>http://www.swixml.org/samples/index.html</location>
<directlocation>
http://www.swixml.org/samples/html/index.html</directlocation>
</link>
<link id="8">
<description>SwiXML Live Demo</description>
<version>0</version>
<location>http://www.carlsbadcubes.com/swixdemo.html</location>
<directlocation>http://www.carlsbadcubes.com/swixdemo.html</directlocation>
</link>
<link id="9">
<description>Java Foundation Classes (JFC)</description>
<version>0</version>
<location>http://java.sun.com/products/jfc/index.jsp</location>
<directlocation>http://java.sun.com/products/jfc/docs.html</directlocation>
</link>
<link id="10">
<description>Swing & Java2D painting (Decorator Pattern)</description>
<version>0</version>
<location>http://java.sun.com/products/jfc/tsc/articles/swing2d/</location>
<directlocation>http://java.sun.com/products/jfc/tsc/articles/swing2d/</directlocation>
</link>
<link id="11">
<description>Java Look and Feel Design
Guidelines</description>
<version>0</version>
<location>http://java.sun.com/products/jlf/ed2/book/</location>
<directlocation>http://java.sun.com/products/jlf/ed2/book/HIG.Part01.html</directlocation>
</link>
</category>
<category id="2" name="Multimedia (JMF)">
<link id="11">
<description>Java Media Framework (JMF)</description>
<version>0</version>
<location>http://java.sun.com/products/java-media/jmf/index.jsp</location>
<directlocation>http://java.sun.com/products/java-media/jmf/reference/docs/index.html</directlocation>
</link>
<link id="12">
<description>JMF - Sound</description>
<version>0</version>
<location>http://java.sun.com/products/java-media/sound/index.jsp</location>
<directlocation>http://java.sun.com/products/java-media/sound/reference/docs/index.html</directlocation>
</link>
<link id="13">
<description>JMF - Graphics</description>
<version>0</version>
<location>http://java.sun.com/products/java-media/2D/index.jsp</location>
<directlocation>http://java.sun.com/products/java-media/2D/reference/docs/index.html</directlocation>
</link>
<link id="14">
<description>JMF - Images</description>
<version>0</version>
<location>http://java.sun.com/products/java-media/jai/index.jsp</location>
<directlocation>http://java.sun.com/products/java-media/jai/reference/docs/index.html</directlocation>
</link>
</category>
<category id="3" name="Java Web Start (JNLP)">
<link id="15">
<description>Java Web Start</description>
<version>0</version>
<location>http://java.sun.com/products/javawebstart/index.jsp</location>
<directlocation>http://java.sun.com/products/javawebstart/reference/docs/index.html</directlocation>
</link>
<link id="16">
<description>JDK 1.4.2 Java Web Start Developer's Guide</description>
<version>1.1-139</version>
<location>http://java.sun.com/j2se/1.4.2/docs/guide/jws/</location>
<directlocation>http://java.sun.com/j2se/1.4.2/docs/guide/jws/developersguide/contents.html</directlocation>
</link>
<link id="17">
<description>Mindprod's Java Web Start tutorial</description>
<version>0</version>
<location>http://mindprod.com/jgloss/javawebstart.html</location>
<directlocation>http://mindprod.com/jgloss/javawebstart.html</directlocation>
</link>
</category>
</categories>
</links>
info.xsl
CODE
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<!-- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -->
<html>
<head>
<link rel="stylesheet" type="text/css" href="info.css"></link>
<title>Belangrijke links voor project "2voor12"</title>
</head>
<body>
<xsl:for-each select="links/categories">
<p>
<xsl:for-each select="category">
<h1><xsl:value-of select="name"/></h1>
<xsl:for-each select="link">
<p>
<table id="link">
<tr>
<td id="cellMeaning">Omschrijving:</td>
<td id="cellDescription"><xsl:value-of select="description"/></td>
</tr>
<tr>
<xsl:choose>
<xsl:when test="version != 0">
<td id="cellMeaning">Versienummer:</td>
<td id="cellVersion"><xsl:value-of select="version"/></td>
</xsl:when>
<xsl:otherwise>
<td id="cellMeaningDisabled">Versienummer:</td>
<td id="cellValueDisabled">(Niet toepasselijk)</td>
</xsl:otherwise>
</xsl:choose>
</tr>
<tr>
<td id="cellMeaning">Locatie:</td>
<td id="cellValue"><a href="{location}"><xsl:value-of select="location"/></a></td>
</tr>
<tr>
<td id="cellMeaning">Directe locatie:</td>
<td id="cellValue"><a href="{directlocation}"><xsl:value-of select="directlocation"/></a></td>
</tr>
</table>
</p>
</xsl:for-each>
</xsl:for-each>
</p>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
De gebruiker opent deze XML, die uiteraard bij jullie wordt gehost, en ziet een netjes overzicht van links met wat omschrijving etc., met een mooie CSS style sheet eraan gehangen.
Het voordeel is dat die XML gemakkelijk (al dan niet handmatig) kan worden aangepast, zonder dat je je druk hoeft te maken om de opmaak (bijv. tabellen).