1
# ***** BEGIN LICENSE BLOCK *****
2
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
# The contents of this file are subject to the Mozilla Public License Version
5
# 1.1 (the "License"); you may not use this file except in compliance with
6
# the License. You may obtain a copy of the License at
7
# http://www.mozilla.org/MPL/
9
# Software distributed under the License is distributed on an "AS IS" basis,
10
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11
# for the specific language governing rights and limitations under the
14
# The Original Code is Mozilla Firefox Help Viewer Source Code.
16
# The Initial Developer of the Original Code is
17
# R.J. Keller <rlk@trfenv.com>
18
# Portions created by the Initial Developer are Copyright (C) 2003-2004
19
# the Initial Developer. All Rights Reserved.
23
# Alternatively, the contents of this file may be used under the terms of
24
# either the GNU General Public License Version 2 or later (the "GPL"), or
25
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26
# in which case the provisions of the GPL or the LGPL are applicable instead
27
# of those above. If you wish to allow use of your version of this file only
28
# under the terms of either the GPL or the LGPL, and not to allow others to
29
# use your version of this file under the terms of the MPL, indicate your
30
# decision by deleting the provisions above and replace them with the notice
31
# and other provisions required by the GPL or the LGPL. If you do not delete
32
# the provisions above, a recipient may use your version of this file under
33
# the terms of any one of the MPL, the GPL or the LGPL.
35
# ***** END LICENSE BLOCK ***** */
36
<?xml version="1.0" encoding="ISO-8859-1"?>
37
<?xml-stylesheet type="text/css" href="helpFileLayout.css"?>
39
<!DOCTYPE stylesheet [
40
<!ENTITY % helpDocDTD SYSTEM "helpDoc.dtd" >
44
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
46
<xsl:output xsl:method="html" xsl:indent="yes" xsl:version="1.1"/>
48
<xsl:template match="/">
51
<title><xsl:value-of select="article/artheader/title"/></title>
52
<link rel="stylesheet" type="text/css" href="helpFileLayout.css"/>
53
<script type="text/javascript">
57
# toggles the visibility of section "item". Also changes the plus sign shown to minus sign
58
# and vice versa depending on the items visiblity.
59
function changeVisibility(item, plus)
61
var divsToHide = document.getElementById(item).getElementsByTagName("*");
62
var currentVisibility = divsToHide.item(2).getAttribute("style");
63
var currentImgSrc = document.getElementById(plus).getAttribute("src");
65
document.getElementById(plus).setAttribute("src", (currentImgSrc == "chrome://global/skin/tree/twisty-clsd.gif") ? "chrome://global/skin/tree/twisty-open.gif" : "chrome://global/skin/tree/twisty-clsd.gif");
67
for (var i = 2; i < divsToHide.length; i++)
68
if (currentVisibility == "display: none;")
69
divsToHide.item(i).removeAttribute("style");
71
divsToHide.item(i).setAttribute("style", "display:none;");
75
# Takes in a String and returns that string with the spaces replaced with underscoes and
77
function spacesToUnderscores(str)
79
if (!str) return null;
82
for (var i = 0; i < str.length; i++)
84
var curChar = str.substring(i, i+1);
88
newStr += curChar.toLowerCase();
93
# Takes in an element("title") and runs spacesToUnderscores(str) on all the elements
96
# You can use the attr parameter to change the attribute to something other than ID
97
# (such as href for hyperlinks).
98
function initalizeIDs(title, attr)
100
var attribute = !attr ? "id" : attr;
101
for (var i = 0; i < document.getElementsByTagName(title).length; i++)
103
var curItem = document.getElementsByTagName(title).item(i);
104
var curId = curItem.getAttribute(attribute);
105
var newId = spacesToUnderscores(curId);
107
curItem.setAttribute(attribute, newId);
113
# set all the IDs and hyperlinks in the document to not have spaces or capital letters.
114
<body onload="initalizeIDs('h2');initalizeIDs('h3');initalizeIDs('img');initalizeIDs('div');initalizeIDs('a', 'href');">
116
<h1 id="top"><xsl:value-of select="article/artheader/title"/></h1>
118
<xsl:for-each select="article/artheader/para">
119
<p><xsl:copy-of select="."/></p>
122
<div class="contentsBox">In this section:
124
<xsl:for-each select="article/sect1">
125
<li><a href="#{title}"><xsl:value-of select="title"/></a></li>
126
<xsl:for-each select="sect2">
133
<xsl:for-each select="article">
134
<xsl:apply-templates/>
137
<div class="contentsBox"><em>Copyright (C) <xsl:copy-of select="article/artheader/copyright/year"/> <xsl:copy-of select="article/artheader/copyright/holder"/></em></div>
138
<p><xsl:copy-of select="helpFile/copyright"/></p>
143
# Create a hiderDiv element so that we can run this through the changeVisibility function when the
144
# user requests a collapse in the help content.
145
<xsl:template match="sect1">
146
<div id="hiderDiv{title}">
147
<xsl:apply-templates/>
151
# Adds the title along with a plus sign to collapse/expand the help topic.
152
<xsl:template match="sect1/title">
153
<h2 id="{.}"><img class="plus" id="plus{.}" onclick="changeVisibility(spacesToUnderscores('hiderDiv{.}'), spacesToUnderscores('plus{.}'));" src="chrome://global/skin/tree/twisty-open.gif"/><xsl:value-of select="."/></h2>
156
<xsl:template match="sect2">
157
<div id="hiderDiv{title}">
158
<xsl:apply-templates/>
163
<xsl:template match="sect2/title">
164
<h3 id="{.}"><img class="plus" id="plus{.}" onclick="changeVisibility(spacesToUnderscores('hiderDiv{.}'), spacesToUnderscores('plus{.}'));" src="chrome://global/skin/tree/twisty-open.gif"/><xsl:value-of select="."/></h3>
167
<xsl:template match="para">
168
<p><xsl:copy-of select="."/></p>
171
<xsl:template match="graphic">
172
<p><img src="{@fileref}" width="{@width}" height="{@height}" alt=""/></p>
175
# Creates a hyperlink for the text of this element. Note that although the code using the section
176
# attribute as the ID to where to go to in the document, the initializeIDs function called in the
177
# body's onload event will change it to the appropriate topic, so you can use the exact title name
178
# (with spaces) if you wish.
179
<xsl:template match="link">
180
<a href="{@location}#{@sect}"><xsl:copy-of select="."/></a>
183
<xsl:template match="indexEntry">