nib rearranging
[TestXSLT.git] / Distribution / readme2html.xsl
1 <?xml version="1.0" encoding="ISO-8859-1"?>\r\r<!-- $Id$ -->\r\r<xsl:stylesheet     version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\r\r<!-- Need to instruct the XSLT processor to use HTML output rules.\r     See http://www.w3.org/TR/xslt#output for more details\r-->\r<xsl:output method="html" encoding="ISO-8859-1"/>\r<xsl:param name="version"/>\r\r\r\r<!-- This first template matches our root element in the input file.\r     This will trigger the generation of the HTML skeleton document.\r     In between we let the processor recursively process any contained\r     elements, which is what the apply-templates instruction does.\r     We also pick some stuff out explicitly in the head section using\r     value-of instructions.\r-->     \r<xsl:template match='readme'>\r\r<html>\r       <head>\r         <title><xsl:value-of select="title"/> v<xsl:value-of select="$version"/></title>\r               <META name="Author" content="{author/text()}"/>\r        </head>\r        \r       <body>\r         <xsl:apply-templates/>\r         \r               <p>&#160;</p>\r          <p>&#160;</p>\r  </body>\r</html>\r\r</xsl:template>\r\r\r\r\r\r\r<!-- Match the readme title. Output as H1 -->\r<xsl:template match="title">\r<h1><xsl:apply-templates/> v<xsl:value-of select="$version"/></h1>\r</xsl:template>\r\r\r\r<!-- Match the author title. Output some code to make it bold.\r     The author element might contain other markup, like the email address.\r     Again, this will be resolved recursively using apply-templates.\r-->\r<xsl:template match="author">\r<p><b><i><xsl:apply-templates/></i></b></p>\r</xsl:template>\r\r\r<!-- Make email an anchor and add angle brackets (lt and gt) -->\r<xsl:template match="email">\r&lt;<a href="mailto:{.}"><xsl:apply-templates/></a>&gt;\r</xsl:template>\r\r\r<!-- Match description. Contains nested para elements -->\r<xsl:template match="description">\r<p>&#160;</p>\r<h2>Description</h2>\r\r<xsl:apply-templates/>\r</xsl:template>\r\r\r\r<!-- paragraphs inside descriptions -->\r<xsl:template match="para">\r<p><xsl:apply-templates/></p>\r</xsl:template>\r\r\r\r<!-- Make URLs into anchors -->\r<xsl:template match="url">\r<a href="{.}"><xsl:apply-templates/></a>\r</xsl:template>\r\r\r\r<!-- Output Requirements title -->\r<xsl:template match="requirements">\r<p>&#160;</p>\r<h2>Requirements</h2>\r<p><xsl:apply-templates/></p>\r</xsl:template>\r\r\r\r<!-- Output version history. Make it a table. Here we have\r     to create the table itself plus the header row. The\r     rest will be handled recursively by the template that\r     matches the entries.\r-->\r<xsl:template match="history">\r<p>&#160;</p>\r<h2>History</h2>\r<table border="0" cellspacing="1" cellpadding="1">\r<tr><th bgcolor="#cccccc">Date</th><th bgcolor="#cccccc">Version</th><th bgcolor="#cccccc">Changes</th></tr>\r\r<xsl:apply-templates/>\r\r</table>\r\r</xsl:template>\r\r\r\r<!-- Inside history, we will find entry elements.\r     For every one of these, we will output a table row.\r     the only special case is the changes column which might\r     contain multiple item values. These are handled in their\r     own template. We'll output them as an unordered list (ul).\r     The ul itself goes into this template, but the individual li\r     items are created in their own template.\r-->\r<xsl:template match="entry">\r\r<tr>\r<td bgcolor="#eeeeee" valign="top" align="right"><xsl:value-of select="date"/></td>\r<td bgcolor="#eeeeee" valign="top" align="center"><xsl:value-of select="version"/></td>\r<td bgcolor="#eeeeee" valign="top">\r<ul>\r  <xsl:apply-templates select="item"/>\r</ul>\r</td>\r</tr>\r</xsl:template>\r\r\r\r<!-- One item element, multiple are possible in an entry.\r     Output a <li> tag, then the item text\r-->\r<xsl:template match="item">\r<li><xsl:apply-templates/></li>\r</xsl:template>\r\r\r\r\r\r</xsl:stylesheet>\r