SGML を使って文書を管理する試み | ||
---|---|---|
Prev |
これは佐藤が SGML を理解することを目的として作成している文書です。 SGML の設定や DSSSL のプログラミングのためのダミー文書ですので、 内容はあまり意味がありません。
このページのソースは、佐藤 <hrs@jp.FreeBSD.org> が DocBook DTD + DSSSL を Jade で処理して HTML ファイルを生成する ことに興味のある方向けに公開しているものです。 特に権利は主張しませんのでご自由にお使いください。 どのような目的で利用されるのか興味があるので、 もしよろしければ教えて頂けると幸いです。
文書を build するには、Makefile.dsssl を使って
% make -f Makefile.dsssl [FORMAT=format]
とします。 format は sgml, tex, rtf の出力フォーマットが指定できます。 FORMAT= は省略可能で、省略した場合は SGML (HTML DTD) で出力されます。
Figure 1-2. 使用している DSSSL スタイルシート
<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [ <!ENTITY % output.html "IGNORE"> <!ENTITY % output.print "IGNORE"> <!ENTITY % lang.ja "IGNORE"> <!ENTITY % lang.ja.dsssl "IGNORE"> <![ %output.html; [ <!ENTITY docbook.dsl PUBLIC "-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN" CDATA DSSSL> ]]> <![ %output.print; [ <!ENTITY docbook.dsl PUBLIC "-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN" CDATA DSSSL> ]]> ]> <!-- This is DSSSL stylesheet for DocBook DTD with Norman Walsh's Modular DocBook Stylesheets Created by Hiroki Sato <hrs@jp.FreeBSD.org> --> <style-sheet> <style-specification use="book"> <style-specification-body> ;; ja-l10n <![ %lang.ja; [ (define %html-header-tags% '(("META" ("HTTP-EQUIV" "Content-Type") ("CONTENT" "text/html; charset=iso-2022-jp")))) ]]> ;; HTML specific configuration (define %root-filename% "index") (define %html-ext% ".html") ;; if you want to use CSS1 stylesheet, activate this. ;;(define %stylesheet% "docbook.css") (define %use-id-as-filename% #t) ;; Generate HTML 4.0 (define %html40% #t) ;; attribute of body element (define %body-attr% (list (list "lang" "JA"))) (define ($html-body-start$) (empty-sosofo)) (define ($html-body-content-start$) (empty-sosofo)) (define ($html-body-content-end$) (empty-sosofo)) (define ($html-body-end$) (empty-sosofo)) ;;(define ($html-body-end$) ;; (make sequence ;; (make element gi: "div" ;; attributes: (list (list "align" "center")) ;; (make element gi: "p" ;; (literal "フッタ"))))) ;; The following is obtained from: ;; ;; > $Id: dbbibl.dsl,v 1.23 2000/07/19 18:40:06 nwalsh Exp $ ;; > ;; > This file is part of the Modular DocBook Stylesheet distribution. ;; ;; and modified for Japanese name order convention. (define (author-string #!optional (author (current-node))) ;; Return a formatted string representation of the contents of: ;; AUTHOR: ;; Handles Honorific, FirstName, SurName, and Lineage. ;; If %author-othername-in-middle% is #t, also OtherName ;; Handles *only* the first of each. ;; Format is "Honorific. FirstName [OtherName] SurName, Lineage" ;; CORPAUTHOR: ;; returns (data corpauthor) (let* ((lang (attribute-string "role" (select-elements author (normalize "author")))) (h_nl (select-elements (descendants author) (normalize "honorific"))) (f_nl (if (equal? lang "family-given") (select-elements (descendants author) (normalize "surname")) (select-elements (descendants author) (normalize "firstname")))) (o_nl (select-elements (descendants author) (normalize "othername"))) (s_nl (if (equal? lang "family-given") (select-elements (descendants author) (normalize "firstname")) (select-elements (descendants author) (normalize "surname")))) (l_nl (select-elements (descendants author) (normalize "lineage"))) (has_h (not (node-list-empty? h_nl))) (has_f (not (node-list-empty? f_nl))) (has_o (and %author-othername-in-middle% (not (node-list-empty? o_nl)))) (has_s (not (node-list-empty? s_nl))) (has_l (not (node-list-empty? l_nl)))) (if (or (equal? (gi author) (normalize "author")) (equal? (gi author) (normalize "editor")) (equal? (gi author) (normalize "othercredit"))) (string-append (if has_h (string-append (data-of (node-list-first h_nl)) %honorific-punctuation%) "") (if has_f (string-append (if has_h " " "") (data-of (node-list-first f_nl))) "") (if has_o (string-append (if (or has_h has_f) " " "") (data-of (node-list-first o_nl))) "") (if has_s (string-append (if (or has_h has_f has_o) " " "") (data-of (node-list-first s_nl))) "") (if has_l (string-append ", " (data-of (node-list-first l_nl))) "")) (data-of author)))) </style-specification-body> </style-specification> <external-specification id="book" document="docbook.dsl"> </style-sheet>