diff html.xsl @ 0:f82309a9465e

Initial commit.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 28 Jul 2011 22:57:08 +0200
parents
children b3644dff344c
line wrap: on
line diff
new file mode 100644
--- /dev/null
+++ b/html.xsl
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="utf-8"?>
+<x:stylesheet version="1.0"
+	xmlns:x="http://www.w3.org/1999/XSL/Transform"
+	xmlns:o="urn:opcodes:description"
+	xmlns="http://www.w3.org/1999/xhtml">
+
+	<x:output encoding="utf-8" indent="yes" method="xml" />
+
+	<x:template match="/o:opcodes">
+		<x:processing-instruction name="xml-stylesheet">type="text/css" href="../style.css"</x:processing-instruction>
+		<html>
+			<head>
+				<title><x:value-of select="o:title"/></title>
+			</head>
+			<body>
+				<h1><x:value-of select="o:title"/></h1>
+				<x:apply-templates select="o:text"/>
+				<x:apply-templates select="o:op"/>
+			</body>
+		</html>
+	</x:template>
+
+	<x:template match="o:text">
+		<div><x:apply-templates/></div>
+	</x:template>
+
+	<x:template match="o:op">
+		<h2 id="i{o:num}">
+			<x:value-of select="o:num"/>
+			<x:if test="o:name != ''">
+				- <small><x:value-of select="o:name"/></small>
+			</x:if>
+		</h2>
+		
+		<x:choose>
+			<x:when test="o:params">
+				<x:apply-templates select="o:params"/>
+			</x:when>
+			<x:otherwise>
+				<p>Takes no parameters.</p>
+			</x:otherwise>
+		</x:choose>
+
+		<p><x:apply-templates select="o:desc"/></p>
+	</x:template>
+
+	<x:template match="o:params">
+		<table>
+			<tr>
+				<th>Type</th>
+				<th>Description</th>
+				<x:if test="o:param/@values"><th>Values</th></x:if>
+				<x:if test="o:param/@min and o:param/@max"><th>Range</th></x:if>
+			</tr>
+			<x:apply-templates select="o:param"/>
+		</table>
+	</x:template>
+
+	<x:template match="o:param">
+		<tr>
+			<td><x:apply-templates select="@type"/></td>
+			<td><x:value-of select="."/></td>
+			<x:if test="@values">
+				<td><x:value-of select="@values"/></td>
+				<x:if test="../o:param/@min and ../o:param/@max"><td/></x:if>
+			</x:if>
+			<x:if test="@min and @max">
+				<x:if test="../o:param/@values"><td/></x:if>
+				<td><x:value-of select="@min"/> to <x:value-of select="@max"/></td>
+			</x:if>
+		</tr>
+	</x:template>
+
+	<x:template match="@type">
+		<x:choose>
+			<x:when test=". = 'c'">int8</x:when>
+			<x:when test=". = 's'">int16</x:when>
+			<x:when test=". = 'S'">int32</x:when>
+			<x:when test=". = 'b'">uint8</x:when>
+			<x:when test=". = 'u'">uint16</x:when>
+			<x:when test=". = 'U'">uint32</x:when>
+			<x:when test=". = 'f'">float</x:when>
+			<x:when test=". = 'd'">double</x:when>
+			<x:when test=". = 'z'">string</x:when>
+			<x:when test=". = 'm'">data</x:when>
+			<x:otherwise><x:value-of select="."/></x:otherwise>
+		</x:choose>
+	</x:template>
+
+	<x:template match="o:desc">
+		<x:choose>
+			<x:when test="o:p">
+				<x:apply-templates/>
+			</x:when>
+			<x:otherwise>
+				<p><x:apply-templates/></p>
+			</x:otherwise>
+		</x:choose>
+	</x:template>
+
+	<x:template match="o:p">
+		<p><x:apply-templates/></p>
+	</x:template>
+
+	<x:template match="o:strong">
+		<strong><x:value-of select="."/></strong>
+	</x:template>
+
+	<x:template match="o:i">
+		<i><x:value-of select="."/></i>
+	</x:template>
+
+	<x:template match="o:br">
+		<br/>
+	</x:template>
+
+	<x:template match="o:ol">
+		<ol><x:apply-templates/></ol>
+	</x:template>
+
+	<x:template match="o:li">
+		<li><x:apply-templates/></li>
+	</x:template>
+
+	<x:template match="o:stage">
+		stage <x:value-of select="."/>
+	</x:template>
+
+	<x:template match="o:ref">
+		<a href="#i{.}">instruction <x:value-of select="."/></a>
+	</x:template>
+</x:stylesheet>