tagging release
[dasher.git] / Data / system.rc / colour.xsl
blob3e8ebe3c9441d679d2cb415a34e98d280d91fb4f
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet version = '1.0'
3 xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
5 <!-- colour.xsl DJCM 2004 -->
7 <xsl:output method="html" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"
8 doctype-public="-//W3C//DTD HTML 4.01//EN"
9 doctype-system="http://www.w3.org/TR/html4/strict.dtd" />
12 <xsl:template match="colours">
13 <html lang="en">
14 <head>
15 <title>Dasher Colour Schemes</title>
16 <!-- Uncomment the following line if your xslt processor doesn't add it.
17 xsltproc from the Gnome project (and available for Windows) does. -->
18 <!-- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -->
19 <link rel="home" title="Home" href="http://www.inference.phy.cam.ac.uk/dasher/"/>
20 <link rel="contact" title="Contact" href="http://www.metafaq.com/faq/dasher/"/>
21 <style type="text/css">
22 .content {font-family : 'Lucida Grande', Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;}
23 .content h1 {border-bottom : 2px solid #4686c2; margin-bottom : 1em;}
24 .content h2 {margin-top : 0;}
25 .content hr{
26 color : #4686c2;
27 background-color : #4686c2;
28 height : 2px;
29 border: 0 solid #4686c2;
30 margin-top : 1em;
31 margin-bottom : 1em;
33 </style>
34 </head>
35 <body>
36 <div class="content">
37 <h1><a><xsl:attribute name="href">http://www.inference.phy.cam.ac.uk/dasher/</xsl:attribute>Dasher </a>
38 <a><xsl:attribute name="href">http://www.inference.phy.cam.ac.uk/dasher/download/alphabets/</xsl:attribute>Alphabets</a></h1>
39 <xsl:apply-templates select="//palette"/>
40 </div>
42 <div style="text-align:right"><em>This page automagically generated by
43 <a><xsl:attribute name="href">http://www.inference.phy.cam.ac.uk/dasher/download/alphabets/colour.xsl</xsl:attribute>
44 colour.xsl
45 </a></em></div>
47 </body>
48 </html>
49 </xsl:template>
51 <xsl:variable name="hex" >0123456789ABCDEF</xsl:variable>
52 <xsl:variable name="col" >0</xsl:variable>
54 <xsl:template match="palette">
55 <h2><xsl:value-of select="@name"/></h2>
56 <table bgcolor="#888888"><tr><td>
57 <table bgcolor="#bbbbbb">
58 <xsl:for-each select="colour"> <tr bgcolor="#ffffee">
59 <td><xsl:number value="position()-1"></xsl:number> </td>
60 <td><xsl:value-of select="@r"/>
61 </td>
62 <td><xsl:value-of select="@g"/></td>
63 <td><xsl:value-of select="@b"/></td>
64 <td> <xsl:call-template name="hexify">
65 <xsl:with-param name="str" select="@r"/>
66 </xsl:call-template>
67 <xsl:call-template name="hexify">
68 <xsl:with-param name="str" select="@g"/>
69 </xsl:call-template>
70 <xsl:call-template name="hexify">
71 <xsl:with-param name="str" select="@b"/>
72 </xsl:call-template>
73 </td>
74 <td>
75 <xsl:attribute name="bgcolor">
76 #<xsl:call-template name="hexify">
77 <xsl:with-param name="str" select="@r"/>
78 </xsl:call-template>
79 <xsl:call-template name="hexify">
80 <xsl:with-param name="str" select="@g"/>
81 </xsl:call-template>
82 <xsl:call-template name="hexify">
83 <xsl:with-param name="str" select="@b"/>
84 </xsl:call-template>
85 </xsl:attribute>
86 <xsl:call-template name="hexify">
87 <xsl:with-param name="str" select="@r"/>
88 </xsl:call-template>
89 <xsl:call-template name="hexify">
90 <xsl:with-param name="str" select="@g"/>
91 </xsl:call-template>
92 <xsl:call-template name="hexify">
93 <xsl:with-param name="str" select="@b"/>
94 </xsl:call-template>
95 </td>
96 </tr>
97 </xsl:for-each>
98 </table></td></tr></table>
99 <hr/>
100 </xsl:template>
103 <xsl:template name="hexify">
104 <xsl:param name="str"/>
105 <xsl:variable name="hex-digit1" select="substring($hex,floor($str div 16) + 1,1)"/>
106 <xsl:variable name="hex-digit2" select="substring($hex,$str mod 16 + 1,1)"/>
107 <xsl:value-of select="concat($hex-digit1,$hex-digit2)"/>
108 </xsl:template>
110 </xsl:stylesheet>