source: gli/trunk/help/gen-many-html.xsl@ 14866

Last change on this file since 14866 was 12724, checked in by kjdon, 18 years ago

added AutoText stuff

  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:java="http://xml.apache.org/xalan/java"
5 extension-element-prefixes="java"
6 exclude-result-prefixes="java">
7
8 <xsl:output method="html" encoding="UTF-8"/>
9
10 <xsl:variable name="diction" select="java:Dictionary.new('en')"/>
11
12
13 <xsl:template match="Document">
14 <xsl:for-each select="Section">
15 <xsl:call-template name="processSection">
16 <xsl:with-param name="sectionHead" select="position()"/>
17 </xsl:call-template>
18 </xsl:for-each>
19 </xsl:template>
20
21
22 <xsl:template match="Reference">
23 <xsl:variable name="target" select="@target"/>
24 <a href="{@target}.htm"><xsl:value-of select="/Document//Section[@name=$target]/Title/Text"/></a>
25 </xsl:template>
26
27
28 <xsl:template match="Section"/>
29
30
31 <xsl:template match="Title"/>
32
33 <xsl:template match="Text">
34 <p><xsl:apply-templates/></p>
35 </xsl:template>
36
37 <xsl:template name="processSection">
38 <xsl:param name="sectionHead"/>
39
40 <html>
41 <head>
42 <title>The Greenstone Librarian Interface - Help Pages</title>
43 </head>
44 <body bgcolor="#E0F0E0">
45 <table border="2" bgcolor="#B0D0B0" cellpadding="5" cellspacing="0" width="100%">
46 <tr>
47 <td align="center" width="15%">
48 <img height="45" src="../gatherer_medium.gif" width="45"/>
49 </td>
50 <td align="center" width="*">
51 <a name="{@name}">
52 <xsl:call-template name="processTitle">
53 <xsl:with-param name="sectionNumber" select="$sectionHead"/>
54 <xsl:with-param name="sectionTitle" select="Title"/>
55 </xsl:call-template>
56 </a>
57 </td>
58 <td align="center" width="15%">
59 <img height="45" src="../gatherer_medium.gif" width="45"/>
60 </td>
61 </tr>
62 </table>
63
64 <xsl:apply-templates/>
65 </body>
66 </html>
67
68 <xsl:for-each select="Section">
69 <xsl:call-template name="processSection">
70 <xsl:with-param name="sectionHead" select="concat($sectionHead, '.', position())"/>
71 </xsl:call-template>
72 </xsl:for-each>
73 </xsl:template>
74
75
76 <xsl:template name="processTitle">
77 <xsl:param name="sectionNumber"/>
78 <xsl:param name="sectionTitle"/>
79
80 <font face="Verdana" size="5">
81 <strong>
82 <xsl:value-of select="concat($sectionNumber, ': ', $sectionTitle/Text)"/>
83 </strong>
84 </font>
85 </xsl:template>
86
87 <xsl:template match="span|img|table|b|br|td|tr|u|i">
88 <xsl:copy><xsl:for-each select="@*"><xsl:copy/></xsl:for-each>
89 <xsl:apply-templates/>
90 </xsl:copy>
91 </xsl:template>
92
93 <xsl:template match="AutoText">
94 <xsl:variable name="value"><xsl:choose><xsl:when test="@key"><xsl:value-of select="java:get($diction, @key, @args)"/></xsl:when><xsl:otherwise><xsl:value-of select="@text"/></xsl:otherwise></xsl:choose></xsl:variable>
95 <xsl:choose>
96 <xsl:when test="@type='button'">
97 <b>&lt;<xsl:value-of select="$value"/>&gt;</b>
98 </xsl:when>
99 <xsl:when test="@type='quoted'">
100 <xsl:text>"</xsl:text><xsl:value-of select="$value"/><xsl:text>"</xsl:text>
101 </xsl:when>
102 <xsl:when test="@type='italics'">
103 <i><xsl:value-of select="$value"/></i>
104 </xsl:when>
105 <xsl:when test="@type='plain'">
106 <xsl:value-of select="$value"/>
107 </xsl:when>
108 <xsl:when test="@type='bold'">
109 <b><xsl:value-of select="$value"/></b>
110 </xsl:when>
111 <xsl:otherwise>
112 <xsl:text>"</xsl:text><xsl:value-of select="$value"/><xsl:text>"</xsl:text>
113 </xsl:otherwise>
114 </xsl:choose>
115 </xsl:template>
116
117</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.