summaryrefslogtreecommitdiff
path: root/frames
diff options
context:
space:
mode:
authorGraydon, Tracy <tracy.graydon@intel.com>2012-08-31 11:34:41 -0700
committerGraydon, Tracy <tracy.graydon@intel.com>2012-08-31 11:34:41 -0700
commitd31c43e62fd5483de3604ef825522501eece7feb (patch)
tree176c351869a67eaf8347faba2e1f3a60fa9caeaf /frames
downloaddocbook-style-dsssl-d31c43e62fd5483de3604ef825522501eece7feb.tar.gz
docbook-style-dsssl-d31c43e62fd5483de3604ef825522501eece7feb.tar.bz2
docbook-style-dsssl-d31c43e62fd5483de3604ef825522501eece7feb.zip
Diffstat (limited to 'frames')
-rw-r--r--frames/ChangeLog5
-rw-r--r--frames/README76
-rw-r--r--frames/docbook.css12
-rw-r--r--frames/docbook.js86
-rw-r--r--frames/frames.dsl131
-rw-r--r--frames/frames.htm19
-rw-r--r--frames/navbar.htm31
7 files changed, 360 insertions, 0 deletions
diff --git a/frames/ChangeLog b/frames/ChangeLog
new file mode 100644
index 0000000..bace2af
--- /dev/null
+++ b/frames/ChangeLog
@@ -0,0 +1,5 @@
+2001-04-02 Norman Walsh <nwalsh@users.sourceforge.net>
+
+ * README, docbook.css, docbook.js, frames.dsl, frames.htm, navbar.htm:
+ New file.
+
diff --git a/frames/README b/frames/README
new file mode 100644
index 0000000..81a0096
--- /dev/null
+++ b/frames/README
@@ -0,0 +1,76 @@
+README for the DocBook Stylesheets Frame Support
+
+Introduction
+------------
+
+Support for frames is a common request. Supporting frames with
+a stylesheet that builds a frames-only version of a document has
+never been very appealing to me, so I haven't bothered. (The
+main problem is that this approach doesn't help solve the
+difficult problem of the navigation frame.)
+
+Recent changes to the stylesheets have made another approach
+practical. The files in this directory provide frames support
+using a set of techniques that require almost no modification
+to the HTML. The single required change is a link to a CSS
+stylesheet.
+
+One benefit of this technique is that I can imaging framed and
+non-framed versions of a document using exactly the same files
+(with symbolic links, or something). The only difference
+between the two versions would be the CSS stylesheet applied.
+
+The downside to this technique is that it requires a fairly modern
+browser. In order for this to work, your browser must support:
+
+ - Frames
+ - Dynamic HTML
+ - CSS
+
+At present, only IE 4.01SP1 (or later, presumably) is supported.
+In particular, Netscape is not supported.
+
+ *************************************************************
+ * I tried for several days to make this implementation work *
+ * in Netscape. As near as I can tell, Netscape through *
+ * version 4.5 simply does not have enough power in its *
+ * object model to make this practical. If you can make it *
+ * work, I'd be delighted to include support for Netscape, *
+ * but I'm not going to spend anymore time on it in the near *
+ * future. *
+ *************************************************************
+
+I'm really disappointed that I can't get this working under some
+browser other than IE.
+
+Installation
+------------
+
+1. Create a directory to hold your framed document
+2. Copy docbook.css, docbook.js, *.htm, and the ../images/toc-*.gif images
+ into that directory.
+3. Process your document with the frames.dsl stylesheet (or an extension
+ thereof).
+4. Fire up your browser and point it at frames.htm. If your document isn't
+ a "<book>", you'll have to edit frames.htm to make the body frame load
+ correctly the first time.
+
+Warranty
+--------
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL NORMAN WALSH OR ANY OTHER
+CONTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Contacting the Author
+---------------------
+
+These stylesheets are maintained by Norman Walsh, <ndw@nwalsh.com>.
+
+The best way to reach norm is by email. You will find additional
+contact information at http://nwalsh.com/~ndw/
diff --git a/frames/docbook.css b/frames/docbook.css
new file mode 100644
index 0000000..0f90516
--- /dev/null
+++ b/frames/docbook.css
@@ -0,0 +1,12 @@
+.NAVHEADER { display: none }
+.NAVFOOTER { display: none }
+.TOC { display: none }
+
+.NAVTOC { margin-left: 15;
+ display: none }
+
+.NAVBTN { font-size: 10pt }
+
+.TOCTITLE { font-size: 10pt;
+ color: blue;
+ text-decoration: underline; }
diff --git a/frames/docbook.js b/frames/docbook.js
new file mode 100644
index 0000000..9e2f4ce
--- /dev/null
+++ b/frames/docbook.js
@@ -0,0 +1,86 @@
+function toggleDiv(id) {
+ // Find element with ID "id" and toggle its display property.
+ // By convention, the ID of the corresponding +/- image is "${id}IMG".
+ var div = eval("document.all." + id);
+ var img = eval("document.all." + id + "IMG");
+ var display = div.style.display;
+
+ if (display != "block") {
+ div.style.display = "block";
+ img.src = "toc-minus.gif";
+ } else {
+ div.style.display = "none";
+ img.src = "toc-plus.gif";
+ }
+}
+
+function link_href(rel) {
+ // Find the LINK element (in the body document) with the specified REL
+ // and return its HREF. Return "" if no such LINK can be found.
+ var body = parent.frames[1].document;
+ var links = body.all.tags("LINK");
+ for (i=0; i<links.length; i++) {
+ if (links(i).getAttribute("REL") == rel) {
+ return links(i).getAttribute("HREF");
+ }
+ }
+
+ return "";
+}
+
+function load_body(href) {
+ // Change the body frame to the specified href. Update the
+ // navigation bar. We use the setTimeout() trick to give the browser
+ // a chance to load the document...
+ var bodyframe = parent.frames[1];
+ if (href != "") {
+ bodyframe.location = href;
+ setTimeout('reset_links()', 50);
+ }
+}
+
+function goto_link(rel) {
+ // Change the body frame to the specified LINK document.
+ var href = link_href(rel);
+ load_body(href);
+}
+
+function link_on(rel) {
+ // Turn on the link
+ navbar = parent.frames[2].document;
+ navbar.all[rel].style.color = "black";
+}
+
+function link_off(rel) {
+ // Turn off the link
+ navbar = parent.frames[2].document;
+ navbar.all[rel].style.color = "gray";
+}
+
+function set_link(rel) {
+ // Set link on if there's somewhere to go, off otherwise
+ link_off(rel);
+
+ if (link_href(rel) != "") {
+ link_on(rel);
+ }
+}
+
+function set_links() {
+ // Set 'em all
+ set_link("HOME");
+ set_link("UP");
+ set_link("PREVIOUS");
+ set_link("NEXT");
+}
+
+function reset_links() {
+ // Reset the links after a load. Make sure we wait until the
+ // document is loaded.
+ var body = parent.frames[1].document;
+ if (body.readyState == 'complete') {
+ set_links();
+ } else {
+ setTimeout('reset_links()', 100);
+ }
+}
diff --git a/frames/frames.dsl b/frames/frames.dsl
new file mode 100644
index 0000000..c5d9ce2
--- /dev/null
+++ b/frames/frames.dsl
@@ -0,0 +1,131 @@
+<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
+<!ENTITY docbook.dsl PUBLIC "-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN" CDATA DSSSL>
+]>
+
+<style-sheet>
+<style-specification use="docbook">
+<style-specification-body>
+
+(define %stylesheet-version%
+ "Modular DocBook HTML Frames Stylesheet version 1.0")
+
+(define %stylesheet% "docbook.css");
+
+(root
+ (make sequence
+ (process-children)
+ (with-mode manifest
+ (process-children))
+ (make-dhtml-toc)))
+
+(define (make-dhtml-toc)
+ (make entity
+ system-id: "toc.htm"
+ (make element gi: "HTML"
+ (make element gi: "HEAD"
+ (make element gi: "TITLE" (literal "DocBook TOC"))
+ ($standard-html-header$)
+ (make element gi: "SCRIPT"
+ attributes: '(("SRC" "docbook.js"))
+ (empty-sosofo)))
+ (make element gi: "BODY"
+ (make element gi: "DIV"
+ (with-mode dhtmltoc
+ (process-children)))))))
+
+(define (dhtml-toc-entry nd gilist)
+ (let* ((subdivnodes (node-list-filter-by-gi (children nd) gilist))
+ (subdivs (and (> (node-list-length subdivnodes) 0)
+ (not (node-list=? nd (sgml-root-element)))))
+ (imgsrc (if subdivs
+ "toc-plus.gif"
+ "toc-blank.gif"))
+ (imgatt (list (list "SRC" imgsrc)
+ (list "BORDER" "0")
+ (list "ID" (string-append (generate-anchor) "IMG"))))
+ (span (if subdivs
+ (make element gi: "SPAN"
+ attributes: (list
+ (list "CLASS" "TOGGLE")
+ (list "onClick"
+ (string-append
+ "toggleDiv('"
+ (generate-anchor)
+ "')")))
+ (make empty-element gi: "IMG"
+ attributes: imgatt))
+ (make element gi: "SPAN"
+ attributes: '(("CLASS" "TOGGLE"))
+ (make empty-element gi: "IMG"
+ attributes: imgatt)))))
+ (if (node-list=? nd (sgml-root-element))
+ (make sequence
+ (make element gi: "NOBR"
+ (make element gi: "SPAN"
+ attributes: (list ;(list "HREF" (href-to (current-node)))
+ (list "onClick" (string-append
+ "load_body(\""
+ (href-to (current-node))
+ "\")"))
+ (list "CLASS" "TOCTITLE"))
+ (element-title-sosofo (current-node))))
+ (make element gi: "DIV"
+ (process-children)))
+ (make sequence
+ (make element gi: "NOBR"
+ span
+ (make element gi: "SPAN"
+ attributes: (list ;(list "HREF" (href-to (current-node)))
+ (list "onClick" (string-append
+ "load_body(\""
+ (href-to (current-node))
+ "\")"))
+ (list "CLASS" "TOCTITLE"))
+ (element-title-sosofo (current-node))))
+ (make element gi: "DIV"
+ attributes: (list (list "CLASS" "NAVTOC")
+ (list "ID" (generate-anchor)))
+ (process-children))))))
+
+(mode dhtmltoc
+ (default (empty-sosofo))
+
+ (element set (dhtml-toc-entry (current-node)
+ (list (normalize "book"))))
+
+ (element book (dhtml-toc-entry (current-node)
+ (list (normalize "part")
+ (normalize "preface")
+ (normalize "chapter")
+ (normalize "appendix")
+ (normalize "reference"))))
+
+ (element preface (dhtml-toc-entry (current-node)
+ (list (normalize "sect1"))))
+
+ (element part (dhtml-toc-entry (current-node)
+ (list (normalize "preface")
+ (normalize "chapter")
+ (normalize "appendix")
+ (normalize "reference"))))
+
+ (element chapter (dhtml-toc-entry (current-node)
+ (list (normalize "sect1"))))
+
+ (element appendix (dhtml-toc-entry (current-node)
+ (list (normalize "sect1"))))
+
+ (element sect1 (dhtml-toc-entry (current-node) '()))
+
+ (element reference (dhtml-toc-entry (current-node)
+ (list (normalize "refentry"))))
+
+ (element refentry (dhtml-toc-entry (current-node) '()))
+)
+
+</style-specification-body>
+</style-specification>
+
+<external-specification id="docbook" document="docbook.dsl">
+
+</style-sheet>
diff --git a/frames/frames.htm b/frames/frames.htm
new file mode 100644
index 0000000..85a607a
--- /dev/null
+++ b/frames/frames.htm
@@ -0,0 +1,19 @@
+<html>
+<head>
+<title>Frames Example</title>
+<LINK REL="STYLESHEET" TYPE="text/css" HREF="docbook.css">
+</head>
+<frameset COLS="20%,*">
+ <frame SRC="toc.htm" NAME="TOC">
+ <frameset ROWS="*,25">
+ <frame SRC="book1.htm" NAME="BODY">
+ <frame SRC="navbar.htm" NAME="NAV" frameborder="no"
+ marginheight=0 marginwidth=10 scrolling="no" >
+ </frameset>
+<noframes>
+<body>
+Your browser does not support frames.
+</body>
+</noframes>
+</frameset>
+</html> \ No newline at end of file
diff --git a/frames/navbar.htm b/frames/navbar.htm
new file mode 100644
index 0000000..2fd6529
--- /dev/null
+++ b/frames/navbar.htm
@@ -0,0 +1,31 @@
+<html>
+<head>
+<title>Navigation</title>
+<script language="JScript" src="docbook.js"></script>
+<LINK REL="STYLESHEET" TYPE="text/css" HREF="docbook.css">
+</head>
+<body onload="set_links()" bgcolor="#C0C0C0">
+<div class="NAVBAR">
+<table width="100%" border=0 cellpadding=0 cellspacing=0>
+<tr>
+ <td width="10%" align="left">
+ <span class="NAVBTN" id="HOME"
+ onClick='goto_link("HOME")'>Home</span>
+ </td>
+ <td width="40%" align="left">
+ <span class="NAVBTN" id="UP"
+ onClick='goto_link("UP")'>Up</span>
+ </td>
+ <td width="40%" align="right">
+ <span class="NAVBTN" id="PREVIOUS"
+ onClick='goto_link("PREVIOUS")'>Prev</span>
+ </td>
+ <td width="10%" align="right">
+ <span class="NAVBTN" id="NEXT"
+ onClick='goto_link("NEXT")'>Next</span>
+ </td>
+</tr>
+</table>
+</div>
+</body>
+</html>