2. DocBook + Norman's DocBook DSSSL StyleSheet Tips

2.1. DSSSL StyleSheet

2.1.1. [DSSSL] author 中で surname などを使うと、日本語の名前が逆順になってしまいます。 正しい順序にするにはどうしたら良いのでしょうか?

これは DocBook ではなく、DSSSL StyleSheet の問題です。 DSSSL StyleSheet では、必ず <firstname>, <surname> の順にレンダリングするようになっています。

解決するには、DSSSL StyleSheet を処理を書き換える必要があります。 書き換えが必要なのは、dbbibl.dsl にある author-string という定義です。 以下に書き換えた例を示します。

Figure 1. 日本語対応版 author-string

;; 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))))

この例を、自分の DSSSL StyleSheet に追加して、 <author> に role 属性を追加してください。

<author role="family-given">
  <surname>佐藤</surname>
  <firstname>広生</firstname>
</author>

これで、きちんと出力されます。 role 属性が指定されていなければ、従来どおりの処理になります。 また、<surname><firstname> の現われる順番には依存しません。

Note

以前は lang 属性による切り替えを紹介していましたが、 role を使う方法が望ましいです。

直接 dbbibl.dsl を書き換えるのは、あまりおすすめしません。