DSSSL Application for a JIS Publishing System

TITLE: DSSSL Application for a JIS (Japanese Industrial Standards) Publishing System
SOURCE: Yushi Komachi
MH Research Committee, INSTAC/JSA, Japan
Email <komachi@y-adagio.com>
STATUS: Document for the 5th ITSIG/TSG
ACTION: For Information
DATE: June 22, 1998
DISTRIBUTION: ITSIG/TSG

NOTE: This document includes some examples of JIS description, where Japanese characters are encoded with shift-JIS.


Table of Content



Abstract

Most Japanese Industrial Standards are today available in electronic form on CD-ROM published by JSA (Japanese Standards Association) with support of MITI (Ministry of International Trade and Industry). Those JIS documents are described in SGML using such a DTD as specified by JIS/TR X 0004, which is a Japanese version of ISO/IEC TR 9573-11. Responding to user requirements for interchanging JIS documents with their formatting information, we introduced the DSSSL into our prototype system for electronic JIS publishing. This paper shows the overview of the developed system and DSSSL specification of JIS formatting.

1. Requirements

The three types of documents are required for document interchange:

In the distributed development of standardization documents, in particular, the interchange of types (1) and (2) documents are indispensable. The SGML (ISO 8879) can enough support the requirements for the interchange of type (1) documents.

There have been employed some file formats of major word processors, e.g., MS-Word, for interchanging type (2) documents. However, those formats are sometimes suffered from an evolution so called "version-up". They result in a number of incompatible documents. Besides, we have experience of miserable interchange of documents between the systems of the same number of version but different language revisions, for example, Japanese version and English version.

We require, therefore, a stable standardized interchange format for type (2) documents. A candidate could be DSSSL (ISO/IEC 10179) but there has been few implementation of DSSSL processor with satisfactory functionality.

The JADE, a free DSSSL processor, has been updated and supports today a number of languages. Using the JADE, we constructed a prototype system for interchanging JIS documents preserving formatting information. Its major purpose is examine the DSSSL specification of JIS formatting and capability of JADE.

2. Prototype System

We have already standardized DTD defined by TR X 0004. The TR is Japanese translated version of ISO/IEC TR 9573-11 and provides DTD with JIS specific modification.

The formatting specification to all the elements for JIS documents were described by DSSSL according to JIS Z 8301 "Rules for the drafting and presentation of Japanese Industrial Standards". The actual DSSSL specification is shown in clause 3. "DSSSL Specification".

Since today's JADE cannot support page image rendering, we use MS-Word 95 for creating page images from the RTF documents of the JADE output.

3. DSSSL Specification

The DSSSL specification conforming to JIS Z 8301 is described by ISO/IEC 10179 as follows.

<!doctype style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN">

(define debug
  (external-procedure "UNREGISTERED::James Clark//Procedure::debug"))

; font-names & font-sizes

(define JIS-logo-size 42mm)
(define text-size 10.5pt)
(define header-size 8pt)
(define major-title-size (* minor-title-size 1.2))
(define minor-title-size (* text-size 1.2))
(define default-line-spacing (* text-size 2))
(define smaller-size 8pt)
(define mincho-font "HeiseiMincho")
(define gothic-font "HeiseiKakuGothic")
(define title-font-family-name gothic-font)
(define text-font-family-name mincho-font)
(define section-space (display-space 10mm min: 10mm max: 20mm priority: 100))

;
; Spacing for lines
;
(define paragraph-line-spacing
  (* text-size 2) )

;
; Spacing for Titles
;
(define (title-spacing lines title-size ratio pri)
  (display-space
    (* (- (* lines paragraph-line-spacing) title-size) ratio)
    priority: pri ))

(define h0t-space-before
  (title-spacing 2.5 major-title-size (/ 3 4) 100) )
(define h0t-space-after
  (title-spacing 2.5 major-title-size (/ 3 4) 100) )
(define h1t-space-before
  (title-spacing 2.5 major-title-size (/ 3 4) 100) )
(define h1t-space-after
  (title-spacing 2.5 major-title-size (/ 4) 100) )
(define h2t-space-before
  (title-spacing 1.5 minor-title-size (/ 2) 90) )
(define h2t-space-after
  (title-spacing 1.5 minor-title-size (/ 2) 90) )
(define h3t-space-before
  (title-spacing 1.5 text-size (/ 2) 80) )
(define h3t-space-after
  (title-spacing 1.5 text-size (/ 2) 80) )
(define h4t-space-before
  (title-spacing 1.5 text-size (/ 2) 70) )
(define h4t-space-after
  (title-spacing 1.5 text-size (/ 2) 70) )
(define h5t-space-before
  (title-spacing 1.5 text-size (/ 2) 60) )
(define h5t-space-after
  (title-spacing 1.5 text-size (/ 2) 60) )
(define h6t-space-before
  (title-spacing 1.5 text-size (/ 2) 50) )
(define h6t-space-after
  (title-spacing 1.5 text-size (/ 2) 50) )

;
; Level Marks of the List
;
(define level-marks '("-" "+" "*" "=" "#" "@" ))

;
; Styles
;
(define default-paragraph-style
  (style
    ;
    ; initial values for paragraph
    ;
    ; lines: wrap 				; default
    ; asis-truncate-char: #f			; default
    ; asis-wrap-char: #f			; default
    ; asis-wrap-indent: #f			; default
    ; first-line-align: #f			; default
    ; alignment-point-offset: 50		; default
    ignore-record-end?: #t
    expand-tabs?: 8
    ; line-spacing: default-line-spacing
    ; line-spacing-priority: 0			; default
    ; min-pre-line-spacing: #f			; default
    ; min-post-line-spacing: #f			; default
    ; min-leading: #f				; default
    first-line-start-indent: text-size
    ; last-line-end-indent: 0pt			; default
    ; hyphenation-char: #\-			; default
    ; hyphenation-ladder-count: 2		; default
    ; hyphenation-remain-char-count: 2		; default
    ; hyphenation-push-char-count: 2		; default
    ; hyphenation-keep: page			; default
    ; hyphenation-exceptions: '()		; default
    ; line-breaking-method: #f			; default
    ; line-composition-method: #f		; default
    ; implicit-bidi-method: #f			; default
    ; glyph-alignment-mode: font		; default
    font-family-name: text-font-family-name
    ; font-weight: medium			; default
    ; font-posture: upright			; default
    ; font-structure: solid			; default
    ; font-proportionate-width: medium		; default
    ; font-name: #f				; default
    font-size: text-size
    ; numbered-lines: #f			; default
    ; line-number: #f				; default
    line-number-side: 'start
    line-number-sep: text-size
    quadding: 'start
    ; last-line-quadding: relative		; default
    ; last-line-justify-limit: 0pt		; default
    ; justify-glyph-space-max-add: 0pt		; default
    ; justify-glyph-space-max-remove: 0pt	; default
    hanging-punct?: #t
    ; widow-count: 2				; default
    ; orphan-count: 2				; default
    language: 'JA
    country: 'JP
    ; position-prefereence: #f 			; default
    ; writing-mode: 'left-to-right		; default
    ; start-indent: 0pt				; default
    ; end-indent: 0pt				; default
    ; span: 1					; default
    ; spapn-weak?: #f				; default
    ; keep-with-previous?: #f			; default
    ; keep-with-next?: #f			; default
    ; break-before: #f				; default
    ; break-after: #f				; default
    ; keep: #f					; default
    ; may-violate-keep-before?: #f		; default
    ; may-violate-keep-after: #f		; default
))

(define default-character-style
  ;
  ; initial values for character
  ;
  (style
    ; char: 					; special defaulting mechanism
    ; char-map: #f				; default
    ; glyph-id: #f				; default
    ; glyph-subst-table: #f			; default
    ; glyph-subst-method: #f			; default
    ; glyph-reorder-method: #f			; default
    ; writing-mode: 'left-to-right		; default
    font-family-name: text-font-family-name	; default
    ; font-weight: medium			; default
    ; font-posture: upright			; default
    ; math-font-posture: upright		; default
    ; font-sturucture: solid			; default
    ; font-proportionate-width: medium		; default
    ; font-name: #f				; default
    font-size: text-size
    ; stretch-factor: 1				; default
    ; hyphenate?: #f				; default
    ; hyphenation-method: #f			; default
    ; kern?: #f					; default
    ; kern-mode: normal				; default
    ; ligature?: #f				; default
    ; allowed-ligatures: '()			; default
    ; space: 					; special defaulting mechanism
    ; input-tab?:				; special defaulting mechanism
    ; input-whitespace-treatment: preserve	; default
    ; input-whitespace?: 			; special defaulting mechanism
    ; punct?:					; special defaulting mechanism
    ; break-before-priority: 			; special defaulting mechanism
    ; break-after-priority:  			; special defaulting mechanism
    ; drop-after-line-break?: 			; special defaulting mechanism
    ; drop-unless-before-line-break?: 		; special defaulting mechanism
    ; math-class: 				; special defaulting mechanism
    ; script: 					; special defaulting mechanism
    ; position-point-shift: 0pt			; default
    language: 'JA
    country: 'JP
    ; color: 					; special defaulting mechanism
    ; inhibit-line-breaks?: #f			; default
))

(define a4p-page-style
  (style
    page-width: 210mm				; A4
    page-height: 297mm 				; A4
    left-margin: 20mm
    right-margin: 20mm
    top-margin: 27mm
    bottom-margin: 32mm
    header-margin: 24mm
    footer-margin: 32mm
    writing-mode: 'left-to-right)
)

(define default-style
  (merge-style default-paragraph-style default-character-style))

;
; default creation
;
(default (empty-sosofo))

;
; SGML document root
;
(root
  (make display-group
    use: default-style
    (process-children) ))

;
; <![ IGNORE [
; <!ENTITY % doctype "standjis"                            -- 文書型名 -->
;
; <!ELEMENT %doctype;   O O  (bibinfo*,%fm.d;,genwarn?,body,
;                             %annxs;,index*,backm?)
;                             -(%main.ex;) +(%ix;|%i.float;|revmark)     >
; ]]>
(element standjis (process-children))

;
; <![ IGNORE [
; <!ELEMENT bibinfo     - O  (titles,edition,version?,language,refnums,
;                             sourceod?,notes?,endorsmt?,developc,replaces*,
;                             replaced*,abstract?,classifn*,keyword*,relstd*,
;                             prodinfo?,otherprm*,othertxt*)  -(%i.float)
;                                         -- bibliographic information -->
; ]]>
;
; ISO版の書誌情報なので無視する。
;
; (element (standjis bibinfo) (empty-sosofo))

;
; <![ IGNORE [
; <!ENTITY % fm.d    "standard*, frontm*"                  -- 前書き類 -->
;
; <!ELEMENT standard    - O  EMPTY        -- 書誌属性記述要素 -->
; <!ATTLIST standard
;         status  (JIS|DJIS|JTR|DJTR|AMS|DAMS|AMT|DAMT)   #REQUIRED
;                 -- 規格種別及び作成段階
;                 JIS   日本工業規格 (Japanese Industrial Standard)
;                 DJIS  JIS規格原案 (Draft JIS)
;                 JTR   JIS標準情報 (JIS Technical Report)
;                 DJTR  JIS標準情報原案 (Draft JIS Technical Report)
;                 AMS   規格追補 (Amendment (Standard))
;                 DAMS  規格追補原案 (Draft Amendment (Standard))
;                 AMT   技術報告追補 (Amendment (Technical Report))
;                 DAMT  技術報告追補原案 (Draft Amendment (Technical Report))
;                 --
;         TRtype    (1|2|3)  #IMPLIED     -- 標準情報のタイプ --
;         notes     CDATA    #IMPLIED     -- 追認、その他 --
;         trnstype  (JSPEC|TABST|TFULL)   #REQUIRED
;                 -- 翻訳タイプ
;                 JSPEC   JIS独自規格 (JIS specific)
;                 TABST   要訳規格 (abstract only translation)
;                 TFULL   全訳規格 (full text translation)
;                 --
;         JISmark   (commidity|process|unspecified)       unspecified
;                 -- JISマーク種別
;                 commidity       指定商品に関する規格
;                 process         指定加工技術に関する規格
;                 unspecified     その他の規格
;                 --
; >
; ]]>
;
;(element standard (empty-sosofo))

;
; <![ IGNORE [
; <!ELEMENT frontm      -- 前書き --
;                       - O  (titlep, toc?,
;                             jforeword?, foreword?, intro?)>
; ]]>
;
(element frontm (process-children))

;
; <![ IGNORE [
; <!ELEMENT titlep      -- 題目ページ --
;                       - O  (refnum,
;                             jtitle, jptitle?, etitle, eptitle?,
;                             pubinfo)>
; ]]>
;
(element titlep
  (make simple-page-sequence
    use: a4p-page-style
    (make paragraph
      keep: 'page
      line-spacing: 50mm
      (make external-graphic
	scale: 'max-uniform
	max-width: 76mm
	max-height: 44mm
	display-alignment: 'start
        break-after-priority: 100
	entity-system-id: 
	  (string-append
	    (attribute-string
	      "status"
	      (select-elements (children (ancestor "standjis")) "standard"))
	    ".bmp")
        notation-system-id: "bmp" )
        (literal " ") )
      (process-matching-children 'jtitle)
      (process-matching-children 'jptitle)
      (process-matching-children 'refnum)
      (process-matching-children 'pubinfo) ))

;
; <![ IGNORE [
; <!ELEMENT jtitle      - O  (tline+)   -- 主題 (日本語) -->
; <!ELEMENT jptitle     - O  (tline+)   -- 部題 (日本語) -->
; <!ELEMENT etitle      - O  (tline+)   -- 主題 (英語) -->
; <!ELEMENT eptitle     - O  (tline+)   -- 部題 (英語) -->
; ]]>
;

(element jtitle
  (make paragraph
    space-before: (display-space 30mm max: 30mm min: 20mm priority: 100)
    font-family-name: gothic-font
    font-name: gothic-font
    font-size: 20pt
    line-spacing: 24pt
    quadding: 'center
    keep: 'page
    use: default-paragraph-style
    (process-children) ))

(element jptitle
  (make paragraph
    font-family-name: gothic-font
    font-name: gothic-font
    font-size: 16pt
    line-spacing: 20pt
    quadding: 'center
    keep: 'page
    use: default-paragraph-style
    (process-children)))

(element tline
  (make paragraph
    space-before: 0pt
    space-after: 0pt
    widow-count: 0
    orphan-count: 0
    (process-children) ))

; (element etitle (empty-sosofo))
; (element eptitle (empty-sosofo))

;
; <![ IGNORE [
; <!ELEMENT refnum      - O  (jisnum, isnum?)   -- 参照番号 -->
; <!ELEMENT jisnum      - O  (divsym, divnum, pubyear)  -- JIS規格番号  -->
; <!ELEMENT divsym      - O  (#PCDATA)  -- 部門記号 -->
; <!ELEMENT divnum      - O  (#PCDATA)  -- 部門内番号 -->
; <!ELEMENT isnum       - O  (#PCDATA)  -- 対応国際規格の番号 -->
; ]]>
;
(element refnum
  (make paragraph
    font-name: gothic-font
    font-size: 14pt
    keep: 'page
    quadding: 'center
    space-before: (display-space 42pt priority: 100)
    space-after: (display-space 14pt priority: 100)
    use: default-paragraph-style
    (process-matching-children 'jisnum)
    (process-matching-children 'isnum) ))

(element isnum
  (make paragraph
    space-before: (display-space 14pt priority: 90)
    (literal "(")
    (make sequence
      font-size: 12pt
      (process-children))
    (literal ")") ))

(element jisnum
  (make paragraph
    (make sequence
      (literal "JIS ")
      (process-matching-children 'divsym)
      (literal " ")
      (process-matching-children 'divnum)
      (make sequence
        font-size: 7pt
        (literal ":")
        (process-matching-children 'pubyear) ))))

(element divsym (process-children))
(element divnum (process-children))
(element pubyear (process-children))

;
; <![ IGNORE [
; <!ELEMENT pubinfo     -- 出版情報 --
;                       - O  (minister,
;                             estdate, (revdate | confdate)*,
;                             ablsdate?, fanndate,
;                             drftbody, authcomm, divch, price,
;                             (udc|ics), kwset?)>
; <!ELEMENT minister    - O  (#PCDATA)  -- 主務大臣 (minister in charge) -->
; <!ELEMENT estdate     - O  (date)     -- 制定日付 (date of establishment) -->
; <!ELEMENT revdate     - O  (date)     -- 改正日付 (date of revision) -->
; <!ELEMENT confdate    - O  (date)     -- 確認日付 (date of confermation) -->
; <!ELEMENT ablsdate    - O  (date)     -- 廃止日付 (date of abolishment) -->
; <!ELEMENT fanndate    - O  (date)     -- 官報公示日付
;                                       (date of formal announcement) -->
; <!ELEMENT drftbody    - O  (#PCDATA)  -- 原案作成協力者 (drafting body) -->
; <!ELEMENT authcomm    - O  (#PCDATA)  -- 審議部会 (authorization committee) --
; >
; <!ELEMENT divch       - O  (#PCDATA)  -- 担当部署 (division in charge) -->
; <!ELEMENT price       - O  (#PCDATA)  -- 価格(円) -->
; <!ELEMENT udc         - O  (#PCDATA)  -- UDC番号 -->
; <!ELEMENT ics         - O  (#PCDATA)  -- ICS番号 -->
; <!ELEMENT kwset       - O  (kw+)      -- キーワード集合 -->
; <!ELEMENT kw          O O  (#PCDATA)  -- キーワード -->
; ]]>
; 
(element pubinfo
  (make sequence
    (make paragraph
      font-name: gothic-font
      font-size: 9pt
      space-before: (display-space 40mm min: 20mm priority: 100)
      quadding: 'center
      keep: 'page
      break-after: 'page
      use: default-paragraph-style
      (process-matching-children 'estdate)
      (process-matching-children 'revdate)
      (process-matching-children 'confdate)
      (process-matching-children 'ablsdate)
      (make display-group
	font-size: 12pt
	space-before: (display-space 10mm priority: 90)
	space-after: (display-space 10mm priority: 90)
        (make paragraph
          (literal "日本工業標準調査会  審議") ))
      (process-matching-children 'divch) )
    (make paragraph
      font-size: 7pt
      line-spacing: 10pt
      space-before: (display-space 190mm min: 100mm priority: 100)
      space-after: (display-space 10mm min: 10mm priority: 100)
      keep: 'page
      use: default-paragraph-style
      (literal " "))
      (make rule
        orientation: 'horizontal
        length: 90mm
        line-thickness: 1pt
        break-before-priority: 100
        break-after-priority: 100
        space-after: (display-space 10mm priority: 100)
        display-alignment: 'center )
      (process-matching-children 'minister)
      (process-matching-children 'fanndate)
      (process-matching-children 'drftbody)
      (process-matching-children 'authcomm) ))


(element estdate
  (make paragraph
    (process-children)
    (literal "  制定") ))

(element revdate
  (make paragraph
    (process-children)
    (literal "  改正") ))

(element confdate
  (make paragraph
    (process-children)
    (literal "  確認") ))

(element ablsdate
  (make paragraph
    (process-children)
    (literal "  廃止") ))

(element divch
  (make paragraph
    (literal "(")
    (process-children)
    (literal " 発行)") ))

(element minister
  (make paragraph
    (literal "主務大臣: ")
    (process-children) ))

(element fanndate
  (make paragraph
    (literal "官報公示: ")
    (process-children) ))

(element drftbody
  (make paragraph
    (literal "原案作成協力者: ")
    (process-children) ))

(element authcomm
  (make paragraph
    (literal "審議部会: ") 
    (process-children) ))


;(element price (empty-sosofo))
;(element udc (empty-sosofo))
;(element ics (empty-sosofo))
;(element kwset (empty-sosofo))
;(element kw (empty-sosofo))

;
; <![ IGNORE [
; <!ELEMENT date        O O  (year, month, day)  -- 日付 -->
; <!ELEMENT year        O O  (#PCDATA)  -- 年(西暦)-->
; <!ELEMENT month       O O  (#PCDATA)  -- 月 -->
; <!ELEMENT day         O O  (#PCDATA)  -- 日 -->
; ]]>
;
(element date (process-children))

(element year
  (make sequence
    (process-children)
    (literal "年") ))

(element month
  (make sequence
    (process-children)
    (literal "月") ))

(element day
  (make sequence
    (process-children)
    (literal "日") ))

;
; <![ IGNORE [
; <!ELEMENT toc         - O  EMPTY  -- 目次(自動生成) -->
; <!ATTLIST toc              level    NUMBER    1
;                            levela   NUMBER    #IMPLIED>
; ]]>
; 
; (element toc (empty-sosofo))

;
; <![ IGNORE [
; <!ELEMENT jforeword   - O  (%m.pseq;)
;                            -- 日本工業規格としてのまえがき -->
; ]]>
;
;(element jforeword
;  (make display-group
;    space-before: (display-space text-size priority: 10)
;    space-after: (display-space text-size priority: 10)
;    (make paragraph
;      font-name: gothic-font
;      space-before: (display-space text-size priority: 10)
;      space-after: (display-space text-size priority: 10)
;      quadding: 'center
;      use: default-paragraph-style
;      (literal "日本工業規格としてのまえがき") )
;    (make paragraph
;      use: default-paragraph-style
;      (process-children) )))

;
; <![ IGNORE [
; <!ELEMENT foreword    - O  ((stdsrc),p*,
;                            (((replace, repcom)|cancel),(%m.pseq;)?)?,
;                            (partlist, (%m.pseq;)?)?)                   >
; ]]>
;
; (element forward (empty-sosofo))

;
; <![ IGNORE [
; <!ELEMENT intro       - O  ((%s.zz;)*, (h2*|p2*))    -- Introduction -->
; <!ATTLIST intro            id       ID        #IMPLIED
;                            stitle   CDATA     #IMPLIED>
; ]]>
;
;(element intro
;  (make sequence
;    use: default-paragraph-style
;    (make paragraph
;      font-name: gothic-font
;      (literal "導入") )
;    (process-children) ))

;
; <![ IGNORE [
; <!ELEMENT stdsrc      O O  (((tc|jtc|tcsc|jtcsc)+, collab*)|
;                             (source, tcadopt))                        >
; <!ELEMENT (tc|jtc|tcsc|jtcsc) - O  (#PCDATA)    -- TC(s) responsible -->
; <!ELEMENT collab      - O  (%m.ph;)                  -- collaborator -->
; <!ELEMENT source      - O  (%m.ph;) -- external source of fast track -->
; <!ELEMENT tcadopt     - O  (#PCDATA)        -- TC adopted fast track -->
; <!ELEMENT replace     - O  (#PCDATA)               -- replacement of -->
; <!ELEMENT repcom      - O  (%m.ph;)        -- comment on replacement -->
; <!ELEMENT cancel      - O  (#PCDATA)    -- recommendation it cancels -->
; <!ELEMENT partlist    - O  EMPTY              -- list of part titles -->
; ]]>
;
; (element stdsrc (empty-sosofo))
; (element collab (empty-sosofo))
; (element source (empty-sosofo))
; (element tcadopt (empty-sosofo))
; (element replace (empty-sosofo))
; (element repcom (empty-sosofo))
; (element cancel (empty-sosofo))
; (element partlist (empty-sosofo))

;
; <![ IGNORE [
; <!ELEMENT genwarn     - -  (p,(%s.zz;)*)          -- General Warning -->
; ]]>
;
(element genwarn (empty-sosofo))

;
; <![ IGNORE [
; <!ELEMENT body        - O  ((gensec,section*)|(scopesec,section*)|
;                            (scope, conf?, refs?, defs?, (symabb|syms)?,
;                                                                 h1*))  >
; ]]>
;
(define (check-ancestor name nd)
  (if (ancestor name nd)
      (ancestor name nd)
      (node-list-error (string-append "no ancestor: " name) nd) ))

(define (node-at-location lst nd)
  (let loop ((root (check-ancestor (car lst) nd))
             (ll (cdr lst)))
    (cond
      ((null? ll) root)
      ((select-elements (children root) (car ll))
       (loop (select-elements (children root) (car ll)) (cdr ll)))
      (else
       (node-list-error (string-append "no child: " (car ll)) root)) )))

(define (title-lines nd)
  (let loop ((ndl (children nd)))
    (cond
      ((node-list-empty? ndl) (literal ""))
      (else
        (make sequence
          (make paragraph
	    font-family-name: gothic-font
	    font-name: gothic-font
	    font-size: 14pt
	    quadding: 'center
	    line-spacing: (* text-size 2)
	    use: default-paragraph-style
            (literal (data (node-list-first ndl))) )
          (loop (node-list-rest ndl)) )))))

(element body 
  (make simple-page-sequence
    right-header:
      (make sequence
        font-size: 7pt
        use: default-paragraph-style
        (literal
          (data
            (node-at-location
              '("standjis" "frontm" "titlep" "refnum" "jisnum" "divsym")
              (current-node) )))
        (literal " ")
        (literal
          (data
            (node-at-location
              '("standjis" "frontm" "titlep" "refnum" "jisnum" "divnum")
              (current-node) )))
        (literal ":")
        (literal
          (data
            (node-at-location
              '("standjis" "frontm" "titlep" "refnum" "jisnum" "pubyear")
              (current-node) )))
        (literal "(")
        (literal
          (data
            (node-at-location
              '("standjis" "frontm" "titlep" "refnum" "isnum")
              (current-node) )))
        (literal ")") )
    use: a4p-page-style
    (make sequence
      (make paragraph
	font-family-name: gothic-font
	font-name: gothic-font
        font-size: 12pt
        quadding: 'center
        line-spacing: (* text-size 2)
        space-before: (display-space text-size priority: 10)
        use: default-paragraph-style
        (literal "日本工業規格") )
      (make paragraph
	font-family-name: gothic-font
        font-name: gothic-font
        font-size: 12pt
        quadding: 'end
        start-indent: (* text-size 4)
        end-indent: (* text-size 4)
        line-spacing: (* text-size 1.2)
        use: default-paragraph-style
        (literal
          (data
            (node-at-location
              '("standjis" "frontm" "titlep" "refnum" "jisnum" "divsym")
              (current-node) )))
        (literal " ")
        (literal
          (data
            (node-at-location
              '("standjis" "frontm" "titlep" "refnum" "jisnum" "divnum")
              (current-node) )))
        (literal ":")
        (literal
          (data
            (node-at-location
              '("standjis" "frontm" "titlep" "refnum" "jisnum" "pubyear")
              (current-node) ))))
      (make paragraph
	font-family-name: gothic-font
        font-name: gothic-font
        font-size: 12pt
        quadding: 'end
        start-indent: (* text-size 4)
        end-indent: (* text-size 4)
        line-spacing: (* text-size 1.2)
        use: default-paragraph-style
        (literal "(")
        (literal
          (data
            (node-at-location
              '("standjis" "frontm" "titlep" "refnum" "isnum")
              (current-node) )))
        (literal ")") )
      (make paragraph
	font-family-name: gothic-font
        font-name: gothic-font
        font-size: 12pt
        quadding: 'center
        start-indent: (* text-size 4)
        end-indent: (* text-size 4)
        line-spacing: (* text-size 2)
        space-before: (display-space text-size priority: 10)
        use: default-paragraph-style
        (title-lines
          (node-at-location
            '("standjis" "frontm" "titlep" "jtitle") (current-node) ))
        (literal " ") )
      (make paragraph
	font-family-name: gothic-font
        font-name: gothic-font
        font-size: 12pt
        quadding: 'center
        start-indent: (* text-size 4)
        end-indent: (* text-size 4)
        line-spacing: (* text-size 2)
        space-before: (display-space text-size priority: 10)
        use: default-paragraph-style
        (title-lines
          (node-at-location
            '("standjis" "frontm" "titlep" "jptitle") (current-node) )))
      (make paragraph
        line-spacing: (* text-size 2)
	font-family-name: gothic-font
        font-name: gothic-font
        font-size: major-title-size
        space-before: h1t-space-before
        space-after: h1t-space-after
        keep-with-next?: #t
        line-spacing: (* major-title-size 1.2)
        use: default-paragraph-style
        (literal "序文") )
      (make paragraph
        line-spacing: (* text-size 2)
        use: default-paragraph-style
        (literal
          (data
            (node-at-location
              '("standjis" "frontm" "jforeword") (current-node))) ))
      (make paragraph
        line-spacing: (* text-size 2)
	font-family-name: gothic-font
        font-name: gothic-font
        font-size: major-title-size
        space-before: h1t-space-before
        space-after: h1t-space-after
        line-spacing: (* major-title-size 1.2)
        keep-with-next?: #t
        use: default-paragraph-style
        (literal "導入") )
      (make paragraph
        line-spacing: (* text-size 2)
        use: default-paragraph-style
        (literal
          (data
            (node-at-location
              '("standjis" "frontm" "intro") (current-node))) ))
      (process-children) )))

;
; Section Level Elements
;
(define (internals nd)
  (cond
    ((string=? "gensec" (gi nd))
     (node-list-length (children nd)) )
    (else 1) ))

(define (section-number nd)
  (cond
   ((string=? "scopesec" (gi nd)) 1)
   ((string=? "scope" (gi nd)) 1)
   ((string=? "conf" (gi nd)) 2)
   ((string=? "refs" (gi nd)) (node-list-length (preced nd)))
   ((string=? "defs" (gi nd)) (node-list-length  (preced nd)))
   ((string=? "symabb" (gi nd)) (node-list-length (preced nd)))
   ((string=? "syms" (gi nd)) (node-list-length (preced nd)))
   (else
    (let loop ((ndl (preced nd))
               (sec (child-number nd)))
      (cond
       ((node-list-empty? ndl) sec)
       (else
        (+ (internals (node-list-first ndl))
           (loop (node-list-rest ndl) sec) )))))))

;
; <![ IGNORE [
; <!ELEMENT gensec      - O  (scope, conf?, refs?, defs?,
;                             (symabb|syms)?,h1*)                        >
; ]]>
;
(element gensec (process-children))

;
; <![ IGNORE [
; <!ELEMENT scopesec    - O  ((%s.zz;)*)    -- section with only scope -->
; ]]>
;
(element scopesec
  (make sequence
    (make paragraph
      font-family-name: gothic-font
      font-name: gothic-font
      font-size: major-title-size
      space-before: h1t-space-before
      space-after: h1t-space-after
      line-spacing: (* major-title-size 1.2)
      keep-with-next?: #t
      use: default-paragraph-style
      (literal (number->string (section-number (current-node))))
      (literal ". 適用範囲") )
    (process-children) ))

;
; <![ IGNORE [
; <!ELEMENT (annexn|annexi)  - O (h0t, (%s.zz;)*, (h1*|p1*))             >
; ]]>
;
(element annexn
  (make paragraph
    break-before: 'page
    font-family-name: gothic-font
    font-name: gothic-font
    font-size: major-title-size
    line-spacing: (* major-title-size 1.2)
    use: default-paragraph-style
    (literal "付属書")
    (literal (format-number (element-number) "A"))
    (literal ":(規定)  ")
    (process-children) ))

(element annexi
  (make paragraph
    break-before: 'page
    font-family-name: gothic-font
    font-name: gothic-font
    font-size: major-title-size
    line-spacing: (* major-title-size 1.2)
    use: default-paragraph-style
    (literal "付属書")
    (literal (format-number (element-number) "A"))
    (literal ":(参考)  ")
    (process-children) ))

(element (annexn h0t) (process-children))
(element (annexi h0t) (process-children))

;
; <![ IGNORE [
; <!ENTITY % bd.d    "scope|conf|symabb|syms"          -- Body elements-->
;
; <!ELEMENT (%bd.d;)    - O  ((%s.zz;)*, (h2*|p2*))
;                                            -- Clauses with fix title -->
; ]]>
;
(element scope
  (make sequence
    (make paragraph
      font-family-name: gothic-font
      font-name: gothic-font
      font-size: major-title-size
      space-before: h1t-space-before
      space-after: h1t-space-after
      line-spacing: (* major-title-size 1.2)
      keep-with-next?: #t
      use: default-paragraph-style
      (literal (number->string (section-number (current-node))))
      (literal ". 適用範囲") )
    (process-children) ))

(element conf
  (make sequence
    (make paragraph
      font-family-name: gothic-font
      font-name: gothic-font
      font-size: major-title-size
      space-before: h1t-space-before
      space-after: h1t-space-after
      line-spacing: (* major-title-size 1.2)
      keep-with-next?: #t
      use: default-paragraph-style
      (literal (number->string (section-number (current-node))))
      (literal ". 適合性") )
    (make paragraph
      use: default-paragraph-style
      (process-children) )))

(element symabb
  (make sequence
    (make paragraph
      font-family-name: gothic-font
      font-name: gothic-font
      font-size: major-title-size
      space-before: h1t-space-before
      space-after: h1t-space-after
      line-spacing: (* major-title-size 1.2)
      keep-with-next?: #t
      use: default-paragraph-style
      (literal (number->string (section-number (current-node))))
      (literal "略語") )
    (process-children) ))

(element syms
  (make sequence
    (make paragraph
      font-family-name: gothic-font
      font-name: gothic-font
      font-size: major-title-size
      space-before: h1t-space-before
      space-after: h1t-space-after
      line-spacing: (* major-title-size 1.2)
      keep-with-next?: #t
      use: default-paragraph-style
      (literal (number->string (section-number (current-node))))
      (literal "記号") )
    (process-children) ))
  
;
; <![ IGNORE [
; <!ELEMENT refs        - O  (reflist)         -- normative references -->
; <!ELEMENT reflist     O O  ((refref,reftit?)+) -- list of references -->
; <!ELEMENT refref      - O  (#PCDATA|note)*    -(%i.float) -- reference -->
; <!ELEMENT reftit      - O  (%m.ph;)  -(refref) -- title of reference -->
; ]]>
;
(element refs
  (make sequence
    (make paragraph
      font-family-name: gothic-font
      font-name: gothic-font
      space-before: h1t-space-before
      space-after: h1t-space-after
      font-size: major-title-size
      line-spacing: (* major-title-size 1.2)
      keep-with-next?: #t
      use: default-paragraph-style
      (literal (number->string (section-number (current-node))))
      (literal ". 引用規格"))
    (process-children) ))

(element reflist (process-children))

(element refref
  (make paragraph
    use: default-paragraph-style
    (process-children)))

(element (refref note)
  (make paragraph
    use: default-paragraph-style
    (make sequence
      font-family-name: gothic-font
      font-name: gothic-font
      (literal "備考"))
    (process-children) ))

(element reftit
  (make paragraph
    font-family-name: gothic-font
    font-name: gothic-font
    use: default-paragraph-style
    (process-children)))

;
; <![ IGNORE [
; <!ELEMENT defs        - O  (defref*,dl?)              -- definitions -->
; <!ELEMENT defref      - O  (#PCDATA)    -(%i.float)     -- reference -->
; ]]>
;
(element defs
  (make sequence
    (make paragraph
      font-family-name: gothic-font
      font-name: gothic-font
      space-before: h1t-space-before
      space-after: h1t-space-after
      font-size: major-title-size
      line-spacing: (* major-title-size 1.2)
      keep-with-next?: #t
      use: default-paragraph-style
      (literal (number->string (section-number (current-node))))
      (literal ". 定義") )
    (process-children) ))

(element defref
  (make paragraph
    font-family-name: gothic-font
    font-name: gothic-font
    line-spacing: default-line-spacing
    use: default-paragraph-style
    (process-children)))

;
; <![ IGNORE [
; <!ELEMENT dl          - -  (((dt+, (dd|ddg))|(dth,dl))*)               >
; <!ELEMENT  dt         - O  %m.ph;                 -- Definition term -->
; <!ELEMENT  dth        - O  %m.ph;             -- Definition term head-->
; <!ELEMENT  dd         - O  %m.pseq;        -- Definition description -->
; <!ELEMENT  ddg        - O  (dd+)     -- Definition description group -->
; ]]>
;
(element dl (process-children))

(element dt
  (make paragraph
    font-family-name: gothic-font
    font-name: gothic-font
    line-spacing: (* text-size 1.2)
    keep-with-next?: #t
    use: default-paragraph-style
    (literal "(")
    (literal
      (format-number
        (child-number)
        (case (node-list-length (ancestor-recursive "dl" (current-node)))
          ((1) "a")
          ((2) "1")
          ((3) "i")
          ((4) "A")
          ((5) "1")
          ((6) "I") )))
    (literal ") ")
    (process-children)))

(define (ancestor-recursive name start)
  (let loop ((nl (empty-node-list))
             (nd start) )
    (cond
      ((node-list-empty? (ancestor name nd)) nl)
      (else
        (loop (node-list nl (ancestor name nd)) (ancestor name nd)) ))))

(define (count-nesting-level start)
  (+ (node-list-length (ancestor-recursive (gi start) start)) 1))

(element dd
  (make paragraph
    start-indent: (* text-size (count-nesting-level (current-node)))
    space-after: (display-space text-size priority: 100)
    line-spacing: (* text-size 1.2)
    keep-with-next?: #t
    use: default-paragraph-style
    (process-children)))


(element (dd p)
  (make paragraph
    start-indent: (* text-size (count-nesting-level (current-node)))
    line-spacing: (* text-size 1.2)
    use: default-paragraph-style
    (process-children)))

(element ddg (process-children))

(element dth
  (make paragraph
    start-indent: (inline-space
                   (* text-size (count-nesting-level (current-node))) )
    line-spacing: (* text-size 1.2)
    use: default-paragraph-style
    (process-children)))

;
; <![ IGNORE [
; <!ELEMENT section     - O  (h0t, (%s.zz;)*, h1*)          -- Section -->
; ]]>
;
(element section (process-children))

;
; <![ IGNORE [
; <!ELEMENT h1          - O  (h1t, (%s.zz;)*, (h2*|p2*))     -- Clause -->
;
; <!ELEMENT h2          - O  (h2t, (%s.zz;)*, (h3*|p3*))  -- Subclause -->
; <!ELEMENT h3          - O  (h3t, (%s.zz;)*, (h4*|p4*)) -- S.s.clause -->
; <!ELEMENT h4          - O  (h4t, (%s.zz;)*, (h5*|p5*))  -- ...clause -->
; <!ELEMENT h5          - O  (h5t, (%s.zz;)*, (h6*|p6*))  -- ...clause -->
; <!ELEMENT h6          - O  (h6t, (%s.zz;)*)             -- ...clause -->
; <!ELEMENT  (h0t|h1t|h2t|h3t|h4t|h5t|h6t)
;                       O O  %m.ph;   -(fig|tab|%ix;) -- Clause titles -->
; ]]>
;

(element h1 (process-children))
(element h2 (process-children))
(element h3 (process-children))
(element h4 (process-children))
(element h5 (process-children))
(element h6 (process-children))

(define (format-number-list num-list)
  (cond
    ((null? num-list) "")
    (else
      (string-append
        (number->string (car num-list))
        "."
        (format-number-list (cdr num-list)) ))))

(element h0t
  (make paragraph
    font-family-name: gothic-font
    font-name: gothic-font
    font-size: major-title-size
    space-before: h0t-space-before
    space-after: h0t-space-after
    quadding: 'center
    keep-with-next?: #t
    first-line-start-indent: 0pt
    use: default-paragraph-style
    (process-children)))

;
; (define (my-number dom nmlist)
;   (node-list-length
;     (let body ((d dom) (nml nmlist))
;       (cond
;         ((null? nml) (empty-node-list))
;         (else
;           (node-list
;             (select-elements
;               (preced (descendants (ancestor d))) (car nml))
;             (body d (cdr nml)) ))))))

(element h1t
  (make paragraph
    font-family-name: gothic-font
    font-name: gothic-font
    font-size: major-title-size
    space-before: h1t-space-before
    space-after: h1t-space-after
    line-spacing: (* major-title-size 1.2)
    first-line-start-indent: 0pt
    keep-with-next?: #t
    use: default-paragraph-style
    (literal
      (format-number-list
        (list
	  ; 4 is for "scope", "conf", "refs" and "defs". Originally, it was
	  ; coded as:
	  ;   (my-number "body" (list "scope" "conf" "refs" "defs" "h1"))
          (+ (car (hierarchical-number (list "h1"))) 4))))
    (literal " ")
    (process-children)))

(element h2t
  (make paragraph
    font-family-name: gothic-font
    font-name: gothic-font
    font-size: minor-title-size
    space-before: h2t-space-before 
    space-after: h2t-space-after
    line-spacing: (* minor-title-size 1.2)
    first-line-start-indent: 0pt
    keep-with-next?: #t
    use: default-paragraph-style
    (literal 
      (format-number-list
        (list
	  ; 4 is for "scope", "conf", "refs" and "defs". Originally, it was
	  ; coded as:
	  ;   (my-number "body" (list "scope" "conf" "refs" "defs" "h1"))
          (+ (car (hierarchical-number (list "h1"))) 4) )))
    (literal (number->string (child-number (parent))))
    (literal " ")
    (process-children) ))

(element h3t
  (make paragraph
    font-family-name: gothic-font
    font-name: gothic-font
    font-size: minor-title-size
    space-before: h3t-space-before
    space-after: h3t-space-after
    line-spacing: (* minor-title-size 1.2)
    first-line-start-indent: 0pt
    keep-with-next?: #t
    use: default-paragraph-style
    (literal 
      (format-number-list
        (list
	  ; 4 is for "scope", "conf", "refs" and "defs". Originally, it was
	  ; coded as:
	  ;   (my-number "body" (list "scope" "conf" "refs" "defs" "h1"))
          (+ (car (hierarchical-number (list "h1"))) 4)
          (car (hierarchical-number (list "h2"))) )))
    (literal (number->string (child-number (parent))))
    (literal " ")
    (process-children)))

(element h4t
  (make paragraph
    font-family-name: gothic-font
    font-name: gothic-font
    space-before: h4t-space-before
    space-after: h4t-space-after
    line-spacing: (* minor-title-size 1.2)
    first-line-start-indent: 0pt
    keep-with-next?: #t
    use: default-paragraph-style
    (literal 
      (format-number-list
        (append
	  ; 4 is for "scope", "conf", "refs" and "defs". Originally, it was
	  ; coded as:
	  ;   (my-number "body" (list "scope" "conf" "refs" "defs" "h1"))
          (list (+ (car (hierarchical-number (list "h1"))) 4))
          (hierarchical-number (list "h2" "h3")) )))
    (literal (number->string (child-number (parent))))
    (literal " ")
    (process-children)))

(element h5t
  (make paragraph
    font-family-name: gothic-font
    font-name: gothic-font
    space-before: h5t-space-before
    space-after: h5t-space-after
    line-spacing: (* minor-title-size 1.2)
    first-line-start-indent: 0pt
    keep-with-next?: #t
    use: default-paragraph-style
    (literal 
      (format-number-list
        (append
	  ; 4 is for "scope", "conf", "refs" and "defs". Originally, it was
	  ; coded as:
	  ;   (my-number "body" (list "scope" "conf" "refs" "defs" "h1"))
          (list (+ (car (hierarchical-number (list "h1"))) 4))
          (hierarchical-number (list "h2" "h3" "h4")) )))
    (literal (number->string (child-number (parent))))
    (literal " ")
    (process-children)))

(element h6t
  (make paragraph
    font-family-name: gothic-font
    font-name: gothic-font
    space-before: h6t-space-before
    space-after: h6t-space-after
    line-spacing: (* minor-title-size 1.2)
    first-line-start-indent: 0pt
    keep-with-next?: #t
    use: default-paragraph-style
    (literal 
      (format-number-list
        (append
	  ; 4 is for "scope", "conf", "refs" and "defs". Originally, it was
	  ; coded as:
	  ;   (my-number "body" (list "scope" "conf" "refs" "defs" "h1"))
          (list (+ (car (hierarchical-number (list "h1"))) 4))
          (hierarchical-number (list "h2" "h3" "h4" "h5")) )))
    (literal (number->string (child-number (parent))))
    (literal " ")
    (process-children)))

; 
; <![ IGNORE [
; <!ELEMENT p1          - O  (p, (%s.zz;)*, (h2*|p2*))       -- Clause -->
; <!ELEMENT p2          - O  (p, (%s.zz;)*, (h3*|p3*))    -- Subclause -->
; <!ELEMENT p3          - O  (p, (%s.zz;)*, (h4*|p4*)) -- Subsubclause -->
; <!ELEMENT p4          - O  (p, (%s.zz;)*, (h5*|p5*))    -- ...clause -->
; <!ELEMENT p5          - O  (p, (%s.zz;)*, (h6*|p6*))    -- ...clause -->
; <!ELEMENT p6          - O  (p, (%s.zz;)*)               -- ...clause -->
; ]]>
; 

(element p1
  (make paragraph
    space-before: text-size
    line-spacing: (* text-size 2)
    use: default-paragraph-style
    (process-children)))

(element p2
  (make paragraph
    space-before: text-size
    line-spacing: (* text-size 2)
    use: default-paragraph-style
    (process-children)))

(element p3
  (make paragraph
    space-before: text-size
    line-spacing: (* text-size 2)
    use: default-paragraph-style
    (process-children)))

(element p4
  (make paragraph
    space-before: text-size
    line-spacing: (* text-size 2)
    use: default-paragraph-style
    (process-children)))

(element p5
  (make paragraph
    space-before: text-size
    line-spacing: (* text-size 2)
    use: default-paragraph-style
    (process-children)))

(element p6
  (make paragraph
    space-before: text-size
    line-spacing: (* text-size 2)
    use: default-paragraph-style
    (process-children)))

;
; <![ IGNORE [
; <!ELEMENT artwork     - O  EMPTY                                       >
; <!ATTLIST artwork          name     ENTITY    #REQUIRED
;                            place    (inline|line) line
;                            height   CDATA     #IMPLIED                 >
; ]]>
;
; 次の指定は、外部識別子の扱いが異なるのでJadeではうまく動かないだろう。
;

(define (select-named-node-by-name nnl name)
  (let loop ((nl nnl))
    (cond
      ((node-list-empty? nl) #f)
      ((string=? (car (named-node-list-names (node-list-first nl))) name)
       (node-list-first nl) )
      (else
        (loop (node-list-rest nl)) ))))

(element artwork
  (make external-graphic
    display?:
     (if (string=? (attribute-string "place") "line")
          #t
          #f)
    scale: 'max-uniform
    max-height: (* 1pt (string->number (attribute-string "height")))
    entity-system-id:
     (let ((ent
            (select-named-node-by-name
             (node-property "entities" (ancestor "sgmldoc"))
             (attribute-string "name") )))
       (node-property "sysid" (node-property "extid" ent)) )
    notation-system-id:
     (let ((ent
            (select-named-node-by-name
             (node-property "entities" (ancestor "sgmldoc"))
             (attribute-string "name") )))
       (node-property "sysid" (node-property "notation" ent)) )
    display-alignment: 'center
    position-point-x: 0pt
    position-point-y: (* 1pt (/ (string->number (attribute-string "height")) 2))
    escapement-direction: 'left-to-right
    break-before-priority: 10
    break-after-priority: 10
    space-before: (display-space 10mm min: 5mm max: 20mm priority: 100)
    space-after: (display-space 20mm min: 10mm max: 40mm priority: 100) ))

;
; <![ IGNORE [
; <!ELEMENT tol         - -
;            (tol.base,tol.unit?,((pos,neg,tol.unit?)|(posneg,tol.unit?)))
;                                                         -- tolerance -->
; <!ELEMENT  tol.base   O O  (#PCDATA)                  -- basic value -->
; <!ELEMENT  tol.unit   - O  (#PCDATA)               -- units of value -->
; <!ELEMENT  pos        - O  (#PCDATA)           -- positive tolerance -->
; <!ELEMENT  neg        - O  (#PCDATA)           -- negative tolerance -->
; <!ELEMENT  posneg     - O  (#PCDATA)                    -- tolerance -->
; ]]>
;
; 利用法調査中:無視する。
;
; (element tol (empty-sosofo)) ; defaulted
; (element tol.unit (empty-sosofo)) ; defaulted
; (element pos (empty-sosofo)) ; defaulted
; (element neg (empty-sosofo)) ; defaulted
; (element posneg (empty-sosofo)) ; defaulted

;
; <![ IGNORE [
; <!ELEMENT revmark     - O  EMPTY                    -- revision mark -->
;
; <!ATTLIST   revmark        onoff    (on|off)   #REQUIRED
;                            version  NMTOKEN    #IMPLIED
;                            status   (new|del)  new                     >
; ]]>
;
; jadeでは、変更線は実現できない。

;
; <![ IGNORE [
; <!ELEMENT syml        - -  ((sym, desc)*)            -- Symbols list -->
; <!ELEMENT  sym        - O  (#PCDATA|(%p.zz.ph;)|artwork)*
;                                            -- Symbol or abbreviation -->
; <!ELEMENT  desc       - O  %m.pseq;            -- Symbol description -->
; ]]>
;
(element syml (process-children))

(element sym
  (make paragraph
    font-family-name: gothic-font
    font-name: gothic-font
    use: default-paragraph-style
    (process-matching-children "sym") ))

(element (syml desc)
  (make paragraph
    use: default-paragraph-style
    (process-matching-children "desc") ))

;
; <![ IGNORE [
; <!ELEMENT varl        - -  ((var, desc)*)           -- Variables list-->
; <!ELEMENT  var        - O  %m.ph;          -- Symbol or abbreviation -->
; ]]>
;

(element varl (process-children))

(element var    
  (make paragraph
    font-family-name: gothic-font
    font-name: gothic-font
    use: default-paragraph-style
    (process-matching-children "sym") ))

(element (varl desc)
  (make paragraph
    use: default-paragraph-style
    (process-matching-children "desc") ))

;
; <![ IGNORE [
; <!ENTITY % ps.ul.d1 "ol|ul|sl"                -- Unit-item lists (1) -->
; <!ENTITY % ps.ul.d2 "nl"                      -- Unit-item lists (2) -->
; <!ENTITY % ps.ul.d "%ps.ul.d1;|%ps.ul.d2"         -- Unit-item lists -->
;
; <!ELEMENT (%ps.ul.d;) - -  (li*)                  -- Unit item lists -->
; ]]>
;
; ol: ordered-list - 項目番号を振る。
; ul: unordered-list - 特別な処理はない。
; sl: sorted-list - 並べ変えは変換処理の機能であって、jadeの対象外。
; nl: named-list - 属性typeによって、タイトルをつけた。
;
(element ol (process-children))
    
(element ul (process-children))

(element sl (process-children))

(element nl
  (make paragraph
    font-family-name: gothic-font
    font-name: gothic-font
    use: default-paragraph-style
    (cond
      ((string=? "NORM" (attribute-string "type"))
       (literal "備考") )
      ((string=? "INFO" (attribute-string "type"))
       (literal "参考") )
      ((string=? "COM" (attribute-string "type"))
       (literal "注") ))
    (literal ":")
    (literal " ")
    (process-children) ))

;
; <![ IGNORE [
; <!ELEMENT  li         - O  %m.pseq;                     -- List item -->
; ]]>
;

(define (ancestors snl)
  (node-list-reverse
    (let body ((nd snl))
      (cond
        ((node-list-empty? nd) (empty-node-list))
        (else
          (node-list (parent nd) (body (parent nd))) )))))

(element (ol li)
  (make paragraph
    first-line-start-indent:
      (+ text-size
         (* text-size 2
           (if (< (node-list-length
                    (ancestor-recursive "li" (current-node)))
                   1)
               0 -1) ))
    start-indent:
      (* text-size 2
         (+ (node-list-length
              (ancestor-recursive "li" (current-node)) ) 1 ))
    use: default-paragraph-style
    (literal "(")
    (literal
      (format-number
        (child-number)
        (case (node-list-length (ancestor-recursive "li" (current-node)))
          ((0) "a")
          ((1) "1")
          ((2) "i")
          ((3) "A")
          ((4) "1")
          ((5) "I") )))
    (literal ") ")
    (process-children) ))

(define (level-mark name lst nd)
  (list-ref lst (node-list-length (ancestor-recursive name nd))) )

(element li
  (make paragraph
    start-indent:
      (* text-size
         (node-list-length (ancestor-recursive "li" (current-node))) )
    line-spacing: (* text-size 1.2)
    space-before: 0pt
    space-after: 0pt
    use: default-paragraph-style
    (literal (level-mark "li" level-marks (current-node)))
    (process-children) ))

(element (li p)
  (make sequence
    (literal " ")
    (process-children) ))

;
; <![ IGNORE [
; <!ELEMENT (note|caution|warning)  - -  (p,(%s.zz;)*)        -- Notes -->
; ]]>
; 
(element note
  (make paragraph
    font-family-name: gothic-font
    font-name: gothic-font
    use: default-paragraph-style
    (cond
      ((string=? "NORM" (attribute-string "type"))
       (literal "備考") )
      ((string=? "INFO" (attribute-string "type"))
       (literal "参考") )
      ((string=? "COM" (attribute-string "type"))
       (literal "注") ))
    (literal ": ")
    (process-children) ))

(element (note p) (process-children))

(element caution
  (make sequence
    (make paragraph
      font-family-name: gothic-font
      font-name: gothic-font
      use: default-paragraph-style
      (literal "注意")
      (literal ": ") )
    (process-children) ))

(element (caution p) (process-children))

(element warning
  (make sequence
    (make paragraph
      font-family-name: gothic-font
      font-name: gothic-font
      use: default-paragraph-style
      (literal "警告")
      (literal ": ") )
    (process-children) ))

(element (warning p) (process-children))

;
; <![ IGNORE [
; <!ELEMENT bl          - -  (bib+)             -- Bibliography (list) -->
; 
; <!ELEMENT  bib        - O ((name+,arttitle?,pubtitle,tittrans?,pubedit?,
;                             publoc?,
;                             publish?,pubyear?,pubvols?,pubref?,pubsize?,
;                             pubpag?,pubibs?,pubctit?,pubprice?)|
;                            (arttitle?,pubtitle,tittrans?,pubfreq?,publoc?,
;                             publish?,
;                             pubsince?,pubref?,pubsize?,pubibs?,
;                             pubprice?,pubotit?)|refref)
;                              -- information for a book and for a
;                               periodical or other serial publication -->
; <!ELEMENT   name      - O (sname,cname?)        -- name of author(s) -->
; <!ELEMENT    sname    O O (#PCDATA)                       -- surname -->
; <!ELEMENT    cname    - O (#PCDATA)                      -- forename -->
; <!ELEMENT   arttitle  - O %m.ph;                    -- article title -->
; <!ELEMENT   pubtitle  - O %m.ph;                            -- title -->
; <!ELEMENT   tittrans  - O %m.ph;                 -- translated title -->
; <!ELEMENT   pubedit   - O (#PCDATA)                       -- edition -->
; <!ELEMENT   pubfreq   - O (#PCDATA)         -- publication frequency -->
; <!ELEMENT   publoc    - O (#PCDATA)          -- publication location -->
; <!ELEMENT   publish   - O %m.ph;                        -- publisher -->
; <!ELEMENT   pubyear   - O (#PCDATA)           -- year of publication -->
; <!ELEMENT   pubsince  - O (#PCDATA)     -- first year of publication -->
; <!ELEMENT   pubvols   - O (#PCDATA)             -- number of volumes -->
; <!ELEMENT   pubref    - O %m.ph;       -- volume or page referred to -->
; <!ELEMENT   pubsize   - O (#PCDATA)                 -- physical size -->
; <!ELEMENT   pubpag    - O (#PCDATA)               -- number of pages -->
; <!ELEMENT   pubibs    - O %m.ph;         -- ills, bibliog, summaries -->
; <!ELEMENT   pubprice  - O (#PCDATA)                         -- price -->
; <!ELEMENT   pubctit   - O %m.ph;              -- title of collection -->
; <!ELEMENT   pubotit   - O %m.ph;            -- old publication title -->
; ]]>
;
; 利用法、スタイルが不明なので省略。

;
; <![ IGNORE [
; <!ELEMENT lines       O O  %m.pseq;                 -- Line elements -->
; ]]>
;
(element lines
  (make line-field
    field-width: (- 210mm 20mm 20mm)
    field-align: 'start
    writing-mode: 'left-to-right
    inhibit-line-breaks?: #t
    break-before-priority: 100
    break-after-priority: 100
    use: default-paragraph-style
    (process-children) ))

;
; <![ IGNORE [
; <!ELEMENT lq          - -  %m.pseq; -(%i.float;)   -- Long quotation -->
; ]]>
;
(element lq
  (make paragraph
    first-line-start-indent: 
      (if (string=? "p" (gi (parent)))
          (* text-size (- 1))
          0pt)
    start-indent: (* 4 text-size (count-nesting-level (current-node)))
    end-indent: (* 4 text-size (count-nesting-level (current-node)))
    font-size: smaller-size
    line-spacing: (* smaller-size 1.2)
    use: default-paragraph-style
    (process-children) ))

;
; <![ IGNORE [
; <!ELEMENT q           - -  %m.ph;                       -- Quotation -->
; ]]>
;
(element q
  (make sequence
    (literal "'")
    (process-children)
    (literal "'") ))

;
; <![ IGNORE [
; <!ELEMENT xmps        - -  (xmp+)                        -- Examples -->
; <!ELEMENT xmp         - -  %m.pseq; -(%i.float;)          -- Example -->
; ]]>
;
(element xmps (process-children))

(element xmp
  (make paragraph
    font-family-name: gothic-font
    font-name: gothic-font
    line-spacing: (* text-size 1.2)    
    start-indent: (* text-size (count-nesting-level (current-node)))
    end-indent: (* text-size (count-nesting-level (current-node)))
    lines: 'asis-wrap
    inline-space-space: (* text-size 0.6)
    expand-tabs?: 8
    (literal "[例")
    (literal (number->string (element-number)))
    (literal "]")
    (make rule
      orientation: 'escapement
      length: 170mm
      line-thickness: 1pt
      break-before-priority: 100
      break-after-priority: 0
      display-alignment: 'start )
    (process-children)
    (make rule
      orientation: 'escapement
      length: 170mm
      line-thickness: 1pt
      break-before-priority: 0
      break-after-priority: 100
      display-alignment: 'start ) ))

;
; <![ IGNORE [
; <!ELEMENT cptr        - -  %m.ph;                -- Computer example -->
; ]]>
;
(element cptr
  (make paragraph
    font-name: "Courier"
    font-size: 9pt
    start-indent: (* text-size (count-nesting-level (current-node)))
    end-indent: (* text-size (count-nesting-level (current-node)))
    lines: 'asis-wrap
    asis-wrap-indent:
      (+ (* text-size (count-nesting-level (current-node)))
	 (* text-size 2) )
    use: default-paragraph-style
    (process-children) ))

;
; <![ IGNORE [
; <!ELEMENT (p|lp)      O O  ((%m.p1;|%m.p2;)*)          -- Paragraphs -->
; ]]>
;
(element p
  (make paragraph
    space-before: text-size
    line-spacing: (* text-size 2)
    use: default-paragraph-style
    (process-children) ))

(element lp
  (make paragraph
    space-before: text-size
    line-spacing: (* text-size 2)
    use: default-paragraph-style
    (process-children) ))

;
; <![ IGNORE [
; <!ELEMENT syn         - -  ((synt,synd)+) --(SGML) syntax productions-->
; <!ELEMENT  synt       - O  (#PCDATA)                         -- term -->
; <!ELEMENT  synd       - O  ((sv|sk|sd|sdr|stv|stc|#PCDATA)*)
;                                                        -- definition -->
; ]]>
;
(element syn
  (make paragraph
    first-line-start-indent: (* text-size (- 4))
    start-indent: (* text-size 8)
    end-indent: (* text-size 4)
    line-spacing: (* text-size 1.2)
    space-after: (display-space text-size priority: 5)
    use: default-paragraph-style
    (process-children) ))

(element synt
  (make sequence
    font-family-name: "Times Roman"
    font-weight: 'medium
    font-posture: 'upright
    (make paragraph-break
      space-before: (* text-size 1.2) )
    (literal "[")
    (literal (number->string (element-number)))
    (literal "] ")
    (process-children)
    (literal "  =  ") ))

(element synd
  (make sequence
    font-family-name: "Times Roman"
    font-weight: 'medium
    font-posture: 'upright
    use: default-paragraph-style
    (process-children) ))

;
; <![ IGNORE [
; <!ELEMENT   sv        - O  (#PCDATA)                     -- variable -->
; <!ELEMENT   sk        - O  (#PCDATA)                      -- literal -->
; <!ELEMENT   sd        - O  (#PCDATA)             -- syntax delimiter -->
; <!ELEMENT   sdr       - O  (#PCDATA)        -- syntax delimiter role -->
; <!ELEMENT   stv       - O  (#PCDATA)    -- syntax terminal, variable -->
; <!ELEMENT   stc       - O  (#PCDATA)    -- syntax terminal, constant -->
; ]]>
; 

(element sv
  (make sequence
    font-family-name: "Times Roman"
    font-posture: 'italic    
    (process-children) ))

(element sk
  (make sequence
    font-family-name: "Courier"
    (process-children) ))

(element sd
  (make sequence
    font-family-name: "Times Roman"
    font-weight: 'bold
    (process-children) ))

(element sdr
  (make sequence
    font-family-name: "Times Roman"
    font-weight: 'bold
    font-posture: 'italic
    (process-children) ))

(element stv
  (make sequence
    font-family-name: "Helvetica"
    font-weight: 'bold
    font-posture: 'oblique
    (process-children) ))

(element stc
  (make sequence
    font-family-name: "Helvetica"
    font-weight: 'bold
    (process-children) ))

;
; <![ IGNORE [
; <!ENTITY % p.em.ph "hp1|hp2|hp3|hp4|hp0|cit"   -- Emphasized phrases -->
; <!ELEMENT (%p.em.ph;) - -  %m.ph;              -- Emphasized phrases -->
; ]]>
;

(element hp0
  (make score
    font-family-name: gothic-font
    font-name: gothic-font
    type: 'after
    score-spaces?: #t
    (process-children) ))

(element hp1
  (make sequence
    font-family-name: gothic-font
    font-name: gothic-font
    (process-children) ))

(element hp2
  (make score
    type: 'after
    score-spaces?: #t
    (process-children) ))

(element hp3
  (make sequence
    (literal "<")
    (process-children)
    (literal ">") ))

(element hp4
  (make sequence
    (literal "[")
    (process-children)
    (literal "]") ))

(element cit
  (make sequence
    font-posture: 'italic
    (literal "“")
    (process-children)
    (literal "”") ))

;
; <![ IGNORE [
; <!ENTITY % p.rf.ph "hdref|figref|tabref|rtref|atref"
;                                                 -- Reference phrases -->
; <!ENTITY % p.rf.d  "fnref|noteref|liref|iref|bibref|tnref|dfref|xmpref"
;                                                -- References (empty) -->
; <!ELEMENT (%p.rf.ph;) - O  %m.ph;               -- Reference phrases -->
; <!ELEMENT (%p.rf.d;)  - O  EMPTY             -- Generated references -->
; ]]>
;
; 変換処理を必要とするので無視する。
;
; (element hdref (empty-sosofo))
; (element figref (empty-sosofo))
; (element tabref (empty-sosofo))
; (element atref (empty-sosofo))
; (element fnref (empty-sosofo))
; (element noteref (empty-sosofo))
; (element liref (empty-sosofo))
; (element iref (empty-sosofo))
; (element bibref (empty-sosofo))
; (element tnref (empty-sosofo))
; (element dfref (empty-sosofo))
; (element xmpref (empty-sosofo))

;
; <![ IGNORE [
; <!ELEMENT extref      - -  (refref,reftit?,refspec?,%EHyTime;)
;                                                -- external reference -->
; <!ELEMENT refspec     - O  (#PCDATA)    -- specific part referred to -->
; ]]>
;

(element extref
  (make sequence
    (process-matching-children "refref")
    (literal "(")
    (process-matching-children "reftit")
    (process-matching-children "refspec")
    (literal ")") ))

(element (extref refref) (process-children))
(element (extref refspec)(process-children))

;
; <![ IGNORE [
; <!ENTITY % p.tm.ph "bot|zoo|microb|term"             -- Term phrases -->
;
; <!ELEMENT (%p.tm.ph;) - -  %m.ph;                    -- Term phrases -->
; ]]>
;
; 利用法調査中:無視する。
; (element bot (empty-sosofo))
; (element zoo (empty-sosofo))
; (element microb (empty-sosofo))
; (element term (empty-sosofo))


;
; <![ IGNORE [
; <!ELEMENT flmat       - -  %m.ph;       -- Foreign language material -->
; ]]>
;
; jadeは、現状ではchar-upcaseをサポートしない。したがって、SGML解析系
; がupper-case変換すると仮定する。
;
(element flmat
  (make sequence
    language: (attribute-string "langcode")
    (process-children) ))

;
; <![ IGNORE [
;                     <!-- Includable Subelements -->
; <!--      ELEMENTS    MIN  CONTENT (EXCEPTIONS)                      -->
; <!ELEMENT fig         - -  (figbody, (figcap, figdesc?)?) -(%i.float;) >
; <!ELEMENT  figbody    O O  (figcomm?,(%s.zz;)*)       -- Figure body -->
; <!ELEMENT  figcomm    - O  %m.ph;                  -- Figure comment -->
; <!ELEMENT  figcap     - O  %m.ph;                  -- Figure caption -->
; <!ELEMENT  figdesc    - O  %m.pseq;            -- Figure description -->
; ]]>
;


;
; <![ IGNORE [
; <!ELEMENT fn          - -  %m.pseq; -(%i.float;)         -- Footnote -->
; ]]>
;
; 現在のjadeでサポートしていないので無視する。
; (element fn (empty-sosofo))

;
; <![ IGNORE [
; <!ELEMENT (i1|i2|i3)  - O  (#PCDATA) -(%ix;)          -- Index entry -->
; <!ELEMENT (ih1|ih2|ih3) - O  (#PCDATA) -(%ix;) -- Index header entry -->
; ]]>
;
; 利用法も不明、変換処理を必要とすると思われるので無視する。

;
; <![ IGNORE [
; <!ELEMENT form        - -  ((%s.zz;|fillin)*)                -- Form -->
; <!ELEMENT fillin      - -  (item?,unit?,subitem*)
;                                               -- Question to fill in -->
; <!ELEMENT  item       - O  (%m.ph;)  -(fillin)     -- item in fillin -->
; <!ELEMENT  unit       - O  (%m.ph;)  -(fillin)       -- unit of item -->
; <!ELEMENT  subitem    - O  (%m.ph;)  -(fillin)  -- subitem in fillin -->
; ]]>
; 

(element form (process-children))

(element fillin
  (make paragraph
    start-indent: (* text-size (count-nesting-level (current-node)))
    end-indent: (* text-size (count-nesting-level (current-node)))
    use: default-paragraph-style
    (process-children)
    (make line-field
      field-width: 50mm
      field-align: 'start
      writing-mode: 'left-to-right
      inhibit-line-breaks?: #t
      break-before-priority: 0
      break-after-priority: 100
      use: default-paragraph-style
      inline-space-space: (inline-space 50mm min: 40mm max: 50mm)
      (literal "[ ]") )))

(element (fillin item)
  (make sequence
    font-family-name: gothic-font
    font-name: gothic-font
    (process-children) ))

(element (fillin unit)
  (make sequence
    font-family-name: gothic-font
    font-name: gothic-font
    (literal "(")
    (process-children)
    (literal ")") ))

(element (fillin subitem) (process-children))

;
; <![ IGNORE [
; <!--      ELEMENTS    MIN  CONTENT (EXCEPTIONS)                      -->
; <!ELEMENT compexp     - -  ((comp,exp)+)  --Explanation of components-->
; <!ELEMENT  comp       - O  (#PCDATA)                    -- Component -->
; <!ELEMENT  exp        - O  %m.pseq;                   -- Explanation -->
; ]]>
;

(element compexp
  (make paragraph
    start-indent: (* text-size 4)
    end-indent: (* text-size 4)
    use: default-paragraph-style
    (process-children) ))

(element comp
  (make line-field
    field-width: 50mm
    field-align: 'start
    writing-mode: 'left-to-right
    break-before-priority: 100
    break-after-priority: 0
    escapement-space-after: (inline-space text-size min: text-size max: (* text-size 4))
    use: default-paragraph-style
    (literal "\bullet")
    (process-children) ))

(element (comexp exp)
  (make line-field
    field-width: 100mm
    field-align: 'start
    writing-mode: 'left-to-right
    break-before-priority: 0
    break-after-priority: 100
    use: default-paragraph-style
    (process-children) ))
 
;
; <![ IGNORE [
; <!--      ELEMENTS    MIN  CONTENT (EXCEPTIONS)                      -->
; <!ELEMENT alterns     - -  ((cond?,altern?)+)        -- alternatives -->
; <!ELEMENT  cond       - O  %m.pseq;     -- condition for alternative -->
; <!ELEMENT  altern     - O  %m.pseq;           -- text of alternative -->
; <!ATTLIST  cond            id       ID        #IMPLIED
;                            label    CDATA     #IMPLIED                 >
; <!ATTLIST  altern          refid    IDREF     #IMPLIED                 >
; ]]>
; 
(element alterns
  (make paragraph
    start-indent: (* text-size 4)
    end-indent: (* text-size 4)
    use: default-paragraph-style
    (process-children) ))

(element "cond"
  (make line-field
    field-width: 50mm
    field-align: 'start
    writing-mode: 'left-to-right
    break-before-priority: 100
    break-after-priority: 0
    escapement-space-after: (inline-space text-size min: text-size max: (* text-size 4))
    use: default-paragraph-style
    (literal "・")
    (process-children) ))

(element altern
  (make line-field
    field-width: 100mm
    field-align: 'start
    writing-mode: 'left-to-right
    break-before-priority: 0
    break-after-priority: 100
    use: default-paragraph-style
    (process-children) ))

;
; <![ IGNORE [
; <!ELEMENT tutorial    - O  ((%s.zz)*, h1*, drftcom*)         -- 解説 -->
; <!ELEMENT drftcom     - -  (c-name, cm-list)       -- 原案作成委員会 -->
; <!ELEMENT c-name      - O  (#PCDATA)                     -- 委員会名 -->
; <!ELEMENT cm-list     - -  (c-mem*)                    -- 委員リスト -->
; <!ELEMENT c-mem       - O  (cm-name, cm-org)                 -- 委員 -->
; <!ELEMENT cm-name     - O  (#PCDATA)                     -- 委員氏名 -->
; <!ELEMENT cm-org      - O  (#PCDATA)                     -- 委員所属 -->
; ]]>
; 
(element backm (process-children))

(element tutorial
  (make sequence
    (make paragraph
      font-size: major-title-size
      font-family-name: gothic-font
      font-name: gothic-font
      space-before: (display-space 20mm priority: 100)
      use: default-paragraph-style
      (literal "解説") )
    (process-children) ))

(element c-name
  (make sequence
    (make paragraph
      font-family-name: gothic-font
      font-name: gothic-font
      use: default-paragraph-style
      (literal "原案作成委員会"))
    (make paragraph
      quadding: 'center
      use: default-paragraph-style
      (process-children)
      (literal "構成表") )))

(element cm-list
  (make paragraph
    use: default-paragraph-style
    (make line-field
      field-width: 100mm
      field-align: 'start
      writing-mode: 'left-to-right
      inhibit-line-breaks?: #t
      break-before-priority: 0
      break-after-priority: 100
      inline-space-space: (inline-space 40mm min: 5mm max: 40mm)
      (literal "氏名 所属"))
    (process-children) ))

(element cm-name
  (make line-field
    field-width: 30mm
    field-align: 'start
    writing-mode: 'left-to-right
    inhibit-line-breaks?: #t
    break-before-priority: 100
    break-after-priority: 0
    escapement-space-after: (inline-space 40mm min: 5mm max: 40mm)
    (process-children) ))    

(element cm-org
  (make line-field
    field-width: 30mm
    field-align: 'start
    writing-mode: 'left-to-right
    inhibit-line-breaks?: #t
    break-before-priority: 100
    break-after-priority: 0
    (process-children) ))

;
; <![ IGNORE [
; <!ELEMENT tab         - -  (tabcap?, tabdesc?, tabcomm?, tabmat,
;                             (%s.zz;)*)                -(%i.float;)     >
; <!ATTLIST tab              id       ID        #IMPLIED
;                            width    CDATA     page
;                            place    (top|fixed|bottom)  top
;                            align    (left|center|right) center
;                            type     (tab|chart|table|form|listing)
;                                               tab
;                            number   CDATA     #IMPLIED                 >
; ]]>
;

(element tab
  (make display-group
    keep: 'page
    position-preference:
      (case (attribute-string "place")
        (("TOP" "top") 'top)
        (("BOTTOM" "bottom") 'bottom)
        (else #f) )
    display-alignment: 
      (case (attribute-string "align")
        (("LEFT" "left") 'start)
        (("CENTER""center") 'center)
        (("RIGHT" "right") 'end) )
    (process-children) ))

;
; <![ IGNORE [
; <!ELEMENT  tabcap     - O  %m.ph;                   -- Table caption -->
; <!ELEMENT  tabdesc    - O  %m.pseq;             -- Table description -->
; <!ELEMENT  tabcomm    - O  %m.ph;                   -- Table comment -->
; ]]>
;
(element tabcap
  (make paragraph
    font-size: smaller-size
    start-indent: (* text-size 4)
    end-indent: (* text-size 4)
    quadding: 'center
    keep-with-next?: #t
    space-before: (display-space text-size priority: 100)
    space-before: (display-space 0pt priority: 100)
    use: default-paragraph-style
    (literal "TABLE-")
    (literal (number->string (element-number)))
    (literal ": ")
    (process-children)))

(element tabdesc
  (make paragraph
    font-size: smaller-size
    start-indent: (* text-size 4)
    end-indent: (* text-size 4)
    keep-with-next?: #t
    use: default-paragraph-style
    (process-children) ))

(element tabcomm
  (make paragraph
    font-size: smaller-size
    start-indent: (* text-size 4)
    end-indent: (* text-size 4)
    keep-with-next?: #t
    use: default-paragraph-style
    (literal "注: ")
    (process-children) ))

;
; <![ IGNORE [
; <!ELEMENT  tabmat     - -  (tabhead?, tabfoot?, tabbody)
;                            -(%i.float;|tabmat)       -- Table matter -->
; <!ATTLIST tabmat           rotate   (0|90|180|270) 0
;                            width    CDATA     #IMPLIED
;                            compact  (compact) #IMPLIED
;                            pointsz  (6|7|8|9|10|11|12|14|16|18|20) %tab.pz;
;                            trules   CDATA     "T B L R"
;                            domains  NMTOKENS  none
;                    -- attributes specifying defaults for lower levels --
;                            gridx    CDATA     "*"
;                            gridy    CDATA     "*"
;                            arrange  CDATA     "none"
;                            rrules   CDATA     "T B L R"
;                            crules   CDATA     "T B L R"
;                            cvalign  (T|C|B)   "T"
;                            caligns  CDATA     "L"
;                            calignps CDATA     "-"
;                                                     >
; ]]>
;

(element tabmat
  (make table
    line-thickness: 2pt
    table-border: #t
    space-before: (display-space text-size priority: 50)
    space-after: (display-space text-size priority: 100)
    font-size:
      (if (attribute-string "pointsz")
          (* 1pt (string->number (attribute-string "pointsz")))
          smaller-size)
    (make table-part
      (process-children) )))

;
; <![ IGNORE [
; <!ELEMENT   (tabhead|tabfoot)  - O   (arow)         -- header/footer -->
;
; <!ATTLIST tabhead          headhi   (0|1|2|3)      %tab.hhi;
;                                                     >
; ]]>
;

(element tabhead
  (make sequence
    font-size: (if (attribute-string "pointsz")
                   (* 1pt (string->number (attribute-string "pointsz")))
                   smaller-size)
    label: 'header
    (process-children) ))

(element tabfoot
  (make sequence
    font-size: (if (attribute-string "pointsz")
                   (* 1pt (string->number (attribute-string "pointsz")))
                   smaller-size)
    label: 'footer
    (process-children) ))

;
; <![ IGNORE [
; <!ELEMENT   tabbody   - O   (arow+)       --Body of tabular material -->
;
; <!ATTLIST tabbody     --   brules   CDATA     "T B L R"  --
;                    -- attributes specifying defaults for lower levels --
;                            gridx    CDATA     #IMPLIED
;                            gridy    CDATA     #IMPLIED
;                            arrange  CDATA     #IMPLIED
;                            rrules   CDATA     #IMPLIED
;                            crules   CDATA     #IMPLIED
;                            cvalign  (T|C|B)   #IMPLIED
;                            caligns  CDATA     #IMPLIED
;                            calignps CDATA     #IMPLIED
;                                                     >
; ]]>
;
(element tabbody
  (make sequence
    font-size: (if (attribute-string "pointsz")
                   (* 1pt (string->number (attribute-string "pointsz")))
                   smaller-size)
    table-border: #t
    (process-children) ))

;
; <![ IGNORE [
; <!ELEMENT    arow     - O  (c+)                      -- Arranged row -->
;
; <!ATTLIST arow             pointsz  (6|7|8|9|10|11|12|14|16|18|20) #IMPLIED
;                            split    (yes|no)  no
;                            gridx    CDATA     #IMPLIED
;                            gridy    CDATA     #IMPLIED
;                            arrange  CDATA     #IMPLIED
;                            rrules   CDATA     #IMPLIED
;                    -- attributes specifying defaults for lower levels --
;                            crules   CDATA     #IMPLIED
;                            cvalign  (T|C|B)   #IMPLIED
;                            caligns  CDATA     #IMPLIED
;                            calignps CDATA     #IMPLIED
;                                                     >
; ]]>
;
(element arow
  (make table-row
    font-size: (if (attribute-string "pointsz")
                   (* 1pt (string->number (attribute-string "pointsz")))
                   smaller-size)
    (process-children) ))

;
; <![ IGNORE [
; <!ELEMENT     c       - O  (sc+)                -- Table matter cell -->
;
; <!ATTLIST c                nr       NUTOKEN   #IMPLIED
;                            pointsz  (6|7|8|9|10|11|12|14|16|18|20) #IMPLIED
;                            type     (head|body) body
;                            rotate   (0|90|180|270) 0
;                            crules   CDATA     #IMPLIED
;                            cvalign  (T|C|B)   #IMPLIED
;                            calign   CDATA     #IMPLIED
;                            calignp  CDATA     #IMPLIED
;                            domain   NMTOKEN   "none"
;                                                     >
; ]]>
;
(element c
  (make table-cell
    font-size: (if (attribute-string "pointsz")
                   (* 1pt (string->number (attribute-string "pointsz")))
                   smaller-size)
    cell-before-row-margin: (/ (inherited-font-size) 2)
    cell-after-row-margin: (/ (inherited-font-size) 2)
    cell-before-column-margin: (/ (inherited-font-size) 2)
    cell-after-column-margin: (/ (inherited-font-size) 2)
    cell-row-alignment: 'start
    line-thickness: 1pt
    cell-before-row-border: #t
    cell-after-row-border: #t
    cell-before-column-border: #t
    cell-after-column-border: #t
    (process-children) ))

;
; <![ IGNORE [
; <!ELEMENT      sc     O O  (#PCDATA|hrule|%s.zz;|%p.zz.ph;)* +(tn)
;                                              --Table matter sub-cell -->
; ]]>
;
(element sc (process-children))

;
; <![ IGNORE [
; <!ELEMENT      tn     - -  %m.pseq;                     -- Tablenote -->
;
; <!ATTLIST tn               id       ID        #IMPLIED>
; ]]>
;
(element tn
  (make paragraph
    font-size: (* 0.7 (inherited-font-size))
    start-indent: (* 0.7 (inherited-font-size))
    use: default-paragraph-style
    (literal "注")
    (process-children) ))

;
; <![ IGNORE [
; <!ELEMENT      hrule  - O  EMPTY                  -- horizontal rule -->
; ]]>
;
(element hrule
  (make rule
    orientation: 'horizontal
    break-before-priority: 100
    break-after-priority: 100
    space-before: (/ (- text-size 1pt) 2)
    space-after: (/ (- text-size 1pt) 2) ))

4. Sample Document

4.1 Source SGML document

For the examination of DSSSL processing, we drafted the following sample JIS text which is SGML encoded with the TR X 0004 DTD.

<!DOCTYPE standjis PUBLIC "-//JIS X XXXX-1996//DTD JIS specific part of DTD for Standards//EN" >

<standjis>
<![ IGNORE [
<!ENTITY % p.em.ph "hp1|hp2|hp3|hp4|hp0|cit"   -- Emphasized phrases -->
<!ENTITY % p.rf.ph "hdref|figref|tabref|rtref|atref"
                                                -- Reference phrases -->
<!ENTITY % p.rf.d  "fnref|noteref|liref|iref|bibref|tnref|dfref|xmpref"
                                               -- References (empty) -->
<!ENTITY % p.tm.ph "bot|zoo|microb|term"             -- Term phrases -->
<!ENTITY % p.zz.ph "f|cf|q|sub|sup|tol|fillin|sv|sk|sd|sdr|stv|stc|flmat|
(%p.em.ph;)|(%p.tm.ph;)|(%p.rf.ph;)|(%p.rf.d;)|extref|refref"
<!ENTITY % m.ph    "(#PCDATA|(%p.zz.ph;))*"          -- Phrase model -->
-->
<!-- definition of doctype("standjis")
<!ENTITY % doctype "standjis"                            -- 文書型名 -->
<!ENTITY % fm.d    "standard*, frontm*"                  -- 前書き類 -->
<!ENTITY % annxs   "(annexn|annexi)*"         -- 附属書類(規格/参考) -->
<!ENTITY % main.ex  "dummy"       -- exclusions at the doctype level -->
<!ENTITY % ix      "i1|i2|i3|ih1|ih2|ih3|iref"      -- Index elements-->
<!ENTITY % i.float "fig|tab|fn"                 -- Floating elements -->
<!ELEMENT %doctype;   O O  (bibinfo*,%fm.d;,genwarn?,body,
                            %annxs;,index*,backm?)
                            -(%main.ex;) +(%ix;|%i.float;|revmark)>
]]>

<![ IGNORE [
<!ELEMENT bibinfo     - O  (titles,edition,version?,language,refnums,
                            sourceod?,notes?,endorsmt?,developc,replaces*,
                            replaced*,abstract?,classifn*,keyword*,relstd*,
                            prodinfo?,otherprm*,othertxt*)  -(%i.float)
                                        -- bibliographic information -->

]]>
<bibinfo apply="test">
<![ IGNORE [
<!ELEMENT titles      O O  (mtitle,ptitle?)+  -- titles (in different
                                          languages) of the standard -->
<!ELEMENT mtitle      - O  (tline+)         -- title of the standard -->
<!ELEMENT tline       O O  %m.ph;                      -- title line -->
]]>
<titles>
<mtitle langcode="JA">
<tline>Test JIS Standard</tline>
<tline>For Evaluating the Formatting Specification</tline>
<tline>Of</tline>
<tline>SGML Encoded JIS Document</tline>
</titles>
<edition>testing</edition>
<version>0.0</version>
<language>JA</language>

<![ IGNORE [
<!ELEMENT refnums     O O  (wdnumber?,number,part?,type?)
                                                -- reference numbers -->
<!ELEMENT wdnumber    - O  (com,sernum)
                                -- document number for working draft -->
<!ELEMENT  com        O O  (#PCDATA)                                   >
<!ELEMENT  sernum     - O  (#PCDATA)                                   >
<!ELEMENT number      - O  (#PCDATA)       -- number of the document -->
<!ELEMENT part        - O  (#PCDATA)           -- number of the part -->
<!ELEMENT type        - O  (#PCDATA)
              -- type of document (types of Technical Report for ISO -->
]]>
<refnums><number>0000</number></refnums>
<![ IGNORE [
<!ELEMENT developc    - O  (status,scdate,votestrt?,voteend?,report?)+
                                  -- stages in the development cycle -->
<!ELEMENT status      - O  (#PCDATA)           -- status of document -->
<!ELEMENT scdate      - O  (#PCDATA)   -- date for the status change -->
]]>
<developc>
<status>WD<scdate>1998/02/23</developc>
</bibinfo>

<![ IGNORE [
<!ELEMENT standard    - O  EMPTY        -- 書誌属性記述要素 -->
<!ATTLIST standard
        status  (JIS|DJIS|JTR|DJTR|AMS|DAMS|AMT|DAMT)   #REQUIRED
                -- 規格種別及び作成段階
                JIS   日本工業規格 (Japanese Industrial Standard)
                DJIS  JIS規格原案 (Draft JIS)
                JTR   JIS技術報告 (JIS Technical Report)
                DJTR  JIS技術報告原案 (Draft JIS Technical Report)
                AMS   規格追補 (Amendment (Standard))
                DAMS  規格追補原案 (Draft Amendment (Standard))
                AMT   技術報告追補 (Amendment (Technical Report))
                DAMT  技術報告追補原案 (Draft Amendment (Technical Report))
                --
        TRtype    (1|2|3)  #IMPLIED     -- 技術報告のタイプ --
        notes     CDATA    #IMPLIED     -- 追認、その他 --
        trnstype  (JSPEC|TABST|TFULL)   #REQUIRED
                -- 翻訳タイプ
                JSPEC   JIS独自規格 (JIS specific)
                TABST   要訳規格 (abstract only translation)
                TFULL   全訳規格 (full text translation)
                --
        JISmark   (commidity|process|unspecified)       unspecified
                -- JISマーク種別
                commidity       指定商品に関する規格
                process         指定加工技術に関する規格
                unspecified     その他の規格
                --
>
]]>
<standard status=JIS trnstype=JSPEC>
<![ IGNORE [
<!ELEMENT frontm      -- 前書き --
                      - O  (titlep, toc?,
                            jforeword?, foreword?, intro?)>
<!--
<!ELEMENT titlep      -- 題目ページ --
                      - O  (refnum,
                            jtitle, jptitle?, etitle, eptitle?,
                            pubinfo)>
]]>
<frontm>
<titlep>
<![ IGNORE [
<!ELEMENT refnum      - O  (jisnum, isnum?)   -- 参照番号 -->
<!ELEMENT jisnum      - O  (divsym, divnum, pubyear)  -- JIS規格番号  -->
<!ELEMENT divsym      - O  (#PCDATA)  -- 部門記号 -->
<!ELEMENT divnum      - O  (#PCDATA)  -- 部門内番号 -->
<!ELEMENT isnum       - O  (#PCDATA)  -- 対応国際規格の番号 -->
]]>
<refnum>
<jisnum>
<divsym>X</divsym>
<divnum>XXXX</divnum>
<pubyear>1998</pubyear></jisnum>
<isnum>ISO AAAA:19xx</isnum>
</refnum>
<jtitle>
<tline>SGML符号化したJIS規格の</tline>
<tline>スタイル指定評価のための</tline>
<tline>サンプルJIS規格</tline>
</jtitle>
<etitle>
<tline>Test JIS Standard</tline>
<tline>For Evaluating the Formatting Specification</tline>
<tline>Of</tline>
<tline>SGML Encoded JIS Document</tline>
</etitle>
<![ IGNORE [
<!ELEMENT pubinfo     -- 出版情報 --
                      - O  (minister,
                            estdate, (revdate | confdate)*,
                            ablsdate?, fanndate,
                            drftbody, authcomm, divch, price,
                            (udc|ics), kwset?)>
<!ELEMENT minister    - O  (#PCDATA)  -- 主務大臣 (minister in charge) -->
<!ELEMENT estdate     - O  (date)     -- 制定日付 (date of establishment) -->
<!ELEMENT revdate     - O  (date)     -- 改正日付 (date of revision) -->
<!ELEMENT confdate    - O  (date)     -- 確認日付 (date of confermation) -->
<!ELEMENT ablsdate    - O  (date)     -- 廃止日付 (date of abolishment) -->
<!ELEMENT fanndate    - O  (date)     -- 官報公示日付
                                      (date of formal announcement) -->
<!ELEMENT drftbody    - O  (#PCDATA)  -- 原案作成協力者 (drafting body) -->
<!ELEMENT authcomm    - O  (#PCDATA)  -- 審議部会 (authorization committee) --
>
<!ELEMENT divch       - O  (#PCDATA)  -- 担当部署 (division in charge) -->
<!ELEMENT price       - O  (#PCDATA)  -- 価格(円) -->
<!ELEMENT udc         - O  (#PCDATA)  -- UDC番号 -->
<!ELEMENT ics         - O  (#PCDATA)  -- ICS番号 -->
<!ELEMENT kwset       - O  (kw+)      -- キーワード集合 -->
<!ELEMENT kw          O O  (#PCDATA)  -- キーワード -->

<!ELEMENT date        O O  (year, month, day)  -- 日付 -->
<!ELEMENT year        O O  (#PCDATA)  -- 年(西暦)-->
<!ELEMENT month       O O  (#PCDATA)  -- 月 -->
<!ELEMENT day         O O  (#PCDATA)  -- 日 -->
]]>
<pubinfo>
<minister>通商産業大臣</minister>
<estdate><year>1997<month>12<day>17</estdate>
<revdate><year>1997<month>12<day>23</revdate>
<revdate><year>1998<month>02<day>23</revdate>
<fanndate><year>1998<month>3<day>31</fanndate>
<drftbody>財団法人 日本規格協会</drftbody>
<authcomm>日本工業標準調査会 情報部会</authcomm>
<divch>財団法人 日本規格協会</divch>
<price>0</price>
<udc>UDC xxx.xxx.xxx: yyy.zzz</udc>
</pubinfo>
</titlep>
<jforeword>
<p>
この規格は、マルチメディア/ハイパーメディア調査研究委員会WG3によって検討したものであって、形式上国際一致規格の構成としているが対応する国際規格は存在しない。
</jforeword>
<intro>
<p>
この規格は、SGML符号化したJIS規格のスタイル指定をテストするために作成されたサンプルであって、実際の規定は一切行わない。
</intro>
</frontm>

<![ IGNORE [
<!ELEMENT body        - O  ((gensec,section*)|(scopesec,section*)|
                           (scope, conf?, refs?, defs?, (symabb|syms)?,
                                                                h1*))  >
]]>
<body>
<scope>
<p>
この規格は、SGML符号化したJIS規格のスタイル指定をテストするために作成されたサンプルであって、実際の規定は一切行わない。SGML符号化したJIS規格のスタイル指定の検証を意図して作成されている。
<conf>
<p>
この規格に適合する必要は全くない。
</conf>
<refs>
<refref>ISO/IEC 10179:1996 - Document Style Semantics and Specification Language</refref>
</refs>
<defs>
<defref>
用語定義リストの例を次に示す。
</defref>
<dl>
<dt>DSSSL</dt>
<dd>Document Style Semantics and Specification Language</dd>
<dt>SGML</dt>
<dd>Standard Generalized Mark-up Language</dd>
<dt>DSSSL処理系</dt>
<dd>DSSSL処理系は、次の二つに分類できる。
<dl>
<dt>変換処理系</dt>
<dd>SGML文書を変換して新たなSGML文書を作成する処理。</dd>
<dt>フォーマット処理</dt>
<dd>スタイル指定を解釈して、SGML文書の構成要素にスタイルを適用する。</dd>
</dl>
</dd>
</dl>
</defs>
<h1>
<h1t>引用と強調</h1t>
<h2><h2t>引用のテスト</h2t>
<p>短い引用はこのように、行内で引用する。エディタemacsのジョークソフトyowは、<q>Is something VIOLENT going to happen to a GARBAGE CAN?</q>と言っている。</p>
<p>長い引用の場合には、このように別途ブロックを作成して引用する。 エディタemacsのジョークソフトyowは、<lq>TAPPING?  You POLITICIANS!  Don't you realize that the END of the ``Wash Cycle'' is a TREASURED MOMENT for most people?!
</lq>とも言っている。</p>
</h2>
<h2>語句の強調のテスト</h2t>
<p>
<ol>
<li>This is <hp0>level0</hp0> high-light.
<li>This is <hp1>level1</hp1> high-light.
<li>This is <hp2>level2</hp2> high-light.
<li>This is <hp3>level3</hp3> high-light.
<li>This is <hp4>level4</hp4> high-light.
</ol>
</h2>
<h1>
<h1t>リスト</h1t>
<p>次にリストの例を示す。
<h2><h2t>順序リスト(ol)のテスト</h2t>
<p>
再びyowが言うには、、、
<ol>
<li>I feel partially hydrogenated!
<li><p>Hello.  Just walk along and try NOT to think about your INTESTINES being almost FORTY YARDS LONG!!
 <ol>
  <li><p>Nest level 2: FROZEN ENTREES may be flung by members of opposing SWANSON SECTS..</p>
   <ol>
    <li>nest level 3: Did you move a lot of KOREAN STEAK KNIVES this trip, Dingy?</li>
   </ol>
  </li>
  <li><p>Nest level 2 again: I want a VEGETARIAN BURRITO to go..  with EXTRA MSG!!</li>
 </ol>
</li>
<li> I'm having a RELIGIOUS EXPERIENCE..  and I don't take any DRUGS
</ol>
<h2><h2t>順序無しリスト(ol)のテスト</h2t>
<p>
順序無しのリストの場合、レベルに応じて次の通りにマークを置く。
<ul>
<li>レベル1
 <ul>
  <li>レベル2
   <ul>
    <li>レベル3
     <ul>
      <li>レベル4
       <ul>
        <li>レベル5
         <ul>
          <li>レベル6
          </li>
         </ul>
        </li>
       </ul>
      </li>
     </ul>
    </li>
   </ul>
  </li>
 </ul>
</li>
</ul>
<h2><h2t>注釈リスト(nl)のテスト</h2t>
<p>
nlは、属性typeによって異なる名前をラベルとしてつけている。
<nl type=norm>
<li>規定事項を記述するリスト(type == norm)。
</nl>
<nl type=info>
<li>参考事項を記述するリスト(type == info)。
</nl>
<nl type=com>
<li>注意事項を記述するリスト(type == com)。
</nl>
<h2><h2t>その他</h2t>
<p>
<note>これら以外にslをサポートしているが、slはulと同じになる。</note>
</h1>

<h1><h1t>表のテスト</h1t>
<p>
<tab align=center>
<tabcap>testing the table element</tabcap>
<tabmat pointsz=9>
<tabhead>
<arow>
<c>x</c>
<c>段1</c>
<c>段2</c>
<c>段3</c>
<c>段4</c>
</tabhead>
<tabbody>
<arow>
<c>行1</c>
<c>セル(1-1)</c>
<c>セル(1-2)</c>
<c>セル(1-3)</c>
<c>セル(1-4)</c>
<arow>
<c>行2</c>
<c>セル(2-1)</c>
<c>セル(2-2)</c>
<c>セル(2-3)</c>
<c>セル(2-4)</c>
</tabbody>
</tabmat>
</tab>
<h1><h1t>生成構文のテスト</h1t>
<p>
<syn>
<synt>
style-planguage-body
<synd>
[[<sv/unit-declaration/*
| <sv/definition/*
| <sv/construction-rule/*
| <sv/mode-construction-rule-group/*
| <sv/application-flow-object-class-declaration/*
| <sv/application-characteristic-declaration/*
| <sv/application-char-characteristic+property-declaration/*
| <sv/initial-value-declaration/*
| <sv/reference-value-type-declaration/*
| <sv/page-model-definition/*
| <sv/column-set-model-definition/*
| <sv/added-char-properties-declaration/*
| <sv/character-property-declaration/*
| <sv/language-definition/*
| <sv/default-language-declaration/?
]]
</syn>
<syn>
<synt>
style-language-expression
<synd>
<sv/make-expression/
| <sv/style-expression/
| <sv/with-mode-expression/
</synd>
<synt>
make-expression
<synd>
<sk/(/<sk/make/ <sv/flow-object-class-name/ <sv/keyword-argument-list/
<sv/content-expression/*<sk/)/
</syn>
</h1>

</body>
<annexi>
<h0t>付属書のテスト
<p>
この付属書は、参考とする。
</annexi>
<backm>
<tutorial>
<p>
この文書はDSSSL指定とペアとなったサンプルであって、DSSSLの実装の一つであるJadeを用いて処理可能なことを確認してある。ただし、Jadeは2バイト文字の扱いをISO 10646に頼っており、次の手順で確認した。
<p>
<ol>
<li>SGML文書をShift_JIS符号化する(このファイル名をtestjis.sgmとする)。
<li>DSSSL指定をShift_JIS符号化する(このファイル名をjisdtd.dslとする)。ただし、この場合円記号をバックスラッシュとはみなさない。そのため、利用できる記号の種別が制限される。
<li>次のコマンドにて、RTFファイルを作成する。
<xmp>
jade -t rtf -d jisdtd.dsl testjis.sgm
</xmp>
<li>作成されたRTFファイルの先頭にあるフォント宣言部を書き換え、日本語表記のフォント名を16進表記のものにする。
<li>結果を、MS-Wordで確認する。
</ol>
<p>
フォント名の書き換えを、次に詳細に示す。
<xmp>
例えば、

{\fonttbl{\f2\fnil\fcharset128 HeiseiKakuGothic;}
{\f1\fnil\fcharset128 HeiseiMincho;}

となっている部分を、次の通りに書き換える。ただし、利用している文字によっては、\fcharset128ではなく\fcharset0をもつ項目が増える場合もある。

{\fonttbl{\f2\fnil\fcharset128 \'82\'6c\'82\'72 \'83\'53\'83\'56\'83\'62\'83\'4e;}
{\f1\fnil\fcharset128 \'82\'6c\'82\'72 \'96\'be\'92\'a9;}
</xmp>
<p>
書き換え文字列は、"MS ゴシック"、"MS 明朝"をShift_JIS符号化し、1バイトごとに符号化したものとなっている。
</tutorial>
</backm>

4.2 JADE output

In the prototype system, we specified the JADE output to be obtained as a RTF form which can be rendered by MS-Word 95 Japanese version. (Other versions of MS-Word cannot render it correctly.)

For easy references, the rendered page images are shown below in JPEG format.

5. Conclusion

We recognized the style specification functionality of DSSSL and style processing capability of JADE required for JIS documents, particularly for the following formatting elements:

The author thanks Mr. Jun Adachi and Prof. Tsuneo Ajisaka for their efforts of developing the DSSSL specification and its experiments on JADE environments.