DSSSL Miscellaneous

Miscellaneous

1. How do I generate output for PalmPilot?
2. olink usage in DSSSL stylesheets
3. Slides in DSSSL
4. String->character nodes
1.

How do I generate output for PalmPilot?

If you want to support AportisDoc convert your SGML source file to TXT first and convert with a command like: makedoc DOCUMENT.txt DOCUMENT.prc

If you want to support iSilo convert your SGML source file to HTML first and convert with a command like: iSilo386 -y -d0 -Idef DOCUMENT.html DOCUMENT.pdb

Carsten Wartmann pointed me to the following tools, which can convert TXT/HTML files to PalmPilot DOC format: txt2pdbdoc and html2pdbtxt.

2.

olink usage in DSSSL stylesheets

Bob Stayton





> I'm still traying to link two different docbook
> documents...

> So, I did what Norm said to me last time. I introduced
> some olinks in my document.

> 1. I modified the document as requred:

> <!DOCTYPE book PUBLIC "-//QUXO//DTD DocBook V1.0//EN" [
>   <!ENTITY % English "INCLUDE">
>   <!ENTITY % projdata SYSTEM "TECHDOC//ENTITIES Project Data V1.0//EN">
>   <!ENTITY glossary SYSTEM "TECHDOC//DOCUMENT Glossary V1.0//EN" CDATA
> SGML>
>   %projdata;
> ]>

> <book id="...">
> ...
> <bookinfo>
>   ...
>   <modespec id="glossary.ms">
>     ../glossary/&proj.code;-glossary.html
>   </modespec>
> </bookinfo>

> <chapter ...>
>   <para>
>     blah, blah, <olink targetdocent="glossary" linkmode="glossary.ms"
>     localinfo="broadsphere">BroadSphere</olink> blah, blah ...
>   </para>
> </chapter>
> </book>

> 2. I downloaded the olink.dsl (strange, in my distribution this file
>    was missing).

> Now, if I have well understood, before using olinks in my document,
> a .olink file should be generated. Ok, but how (I use OpenJade)?

> Using olinks, file extensions must be either .sgml or .xml. isn't it?

The .olink file is a summary of all the xref targets. It is generated by processing the target document with the olink.dsl stylesheet and saving the file to the same filename as your document but with a .olink extension. So if your document is "mybook.sgml" then you do something like:

jade -d olink.dsl -o mybook.olink mybook.sgml

When the docbook.dsl stylesheet processes another document that includes an olink with attribute targetdocent="mybook" (as an entity reference that points to mybook.sgml), it reads mybook.olink to get the summary data to form the link.

Anyone trying to use the existing olink mechanim pretty much needs to keep a copy of Norm's document handy.

3.

Slides in DSSSL

Jirka Kosek

I created customization for DSSSL stylesheets to deal with Slides DTD. It gave me better results than provided fo-plain.xsl. You must change path pointing to base DSSSL print stylesheet in

<!ENTITY docbook.dsl SYSTEM "/src/db/dsssl/print/docbook.dsl" CDATA
DSSSL>

in order to use it.

<!DOCTYPE style-sheet 
 PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
<!ENTITY docbook.dsl SYSTEM 
 "/src/db/dsssl/print/docbook.dsl" CDATA DSSSL>
]>

<style-specification id="docbook-webapp-print" use="docbook">

(define %visual-acuity% "my")
(define %paper-type% "A4")

(define %body-start-indent% 0pi)
(define %verbatim-size-factor% 0.95)

(define %callout-default-col% 70)

(element property ($mono-seq$))

(define %bf-size%
  ;; Defines the body font size
  (case %visual-acuity%
    (("tiny") 8pt)
    (("normal") 10pt)
    (("eleven") 11pt)
    (("my") 14pt)
    (("presbyopic") 12pt)
    (("large-type") 24pt)))

(define %body-font-family% "Verdana")
(define %title-font-family% "Verdana")

(define %graphic-extensions% 
  ;; List of graphic filename extensions
  '("eps" "wmf" "epsf" "gif" "tif" "tiff" "jpg" "jpeg" "png"))

(element slides
  (make simple-page-sequence
    page-n-columns: %page-n-columns%
    page-number-format: ($page-number-format$)
    use: default-text-style
    left-header:   ($left-header$)
    center-header:  (literal "")
    right-header:  ($right-header$)
;;    left-footer:   (literal (data 
       (select-elements (children 
         (select-elements (children (current-node)) 
        (normalize "slidesinfo"))) (normalize "title"))))
    left-footer: ($left-footer$)
    center-footer: ($center-footer$)
    right-footer:  ($right-footer$)
    start-indent: %body-start-indent%
    input-whitespace-treatment: 'collapse
    quadding: %default-quadding%
    (process-children)))

(element slidesinfo
  (make sequence
    quadding: 'center
  (process-children)))

(element (slidesinfo author)
  (make paragraph
    quadding: 'center
    space-before: 96pt
    space-after: 96pt
  (next-match)))

(element (slidesinfo copyright)
  (empty-sosofo))

(element (slidesinfo title)
  (let* ((renderas (attribute-string "renderas"))
	 (hlevel 0)                   
	 (hs (HSIZE (- 4 hlevel))))
    (make paragraph
      font-family-name: %title-font-family%
      font-weight:  (if (< hlevel 5) 'bold 'medium)
      font-posture: (if (< hlevel 5) 'upright 'italic)
      font-size: hs
      line-spacing: (* hs %line-spacing-factor%)
      space-before: (* hs %head-before-factor%)
      space-after: (* hs %head-after-factor%)
      start-indent: (if (< hlevel 3)
			0pt
			%body-start-indent%)
      first-line-start-indent: 0pt
      quadding: 'center
      keep-with-next?: #t
      (process-children))))

(element (slidesinfo subtitle)
  (let* ((renderas (attribute-string "renderas"))
	 (hlevel 2)                   
	 (hs (HSIZE (- 4 hlevel))))
    (make paragraph
      font-family-name: %title-font-family%
      font-weight:  (if (< hlevel 5) 'bold 'medium)
      font-posture: (if (< hlevel 5) 'upright 'italic)
      font-size: hs
      line-spacing: (* hs %line-spacing-factor%)
      space-before: (* hs %head-before-factor%)
      space-after: (* hs %head-after-factor%)
      start-indent: (if (< hlevel 3)
			0pt
			%body-start-indent%)
      first-line-start-indent: 0pt
      quadding: 'center
      keep-with-next?: #t
      (process-children))))
  

(element foil
;;  (make paragraph
;;    break-before: 'page
  (make simple-page-sequence
    page-n-columns: %page-n-columns%
    page-number-format: ($page-number-format$)
    use: default-text-style
    left-header:   (literal (data 
  (select-elements (children (parent (current-node))) (normalize "title"))))
    center-header: ($center-header$)
    right-header:  (literal (data 
 (select-elements (children (current-node)) (normalize "title"))))
    left-footer:   (literal (data 
			     (select-elements
			      (children
			       (select-elements
				(children
				 (select-elements 
				  (parent
				   (select-elements 
				    (parent (current-node)) 
				    (normalize "section"))) 
				  (normalize "slides")))
				(normalize "slidesinfo")))
			      (normalize "title"))))
    center-footer: ($center-footer$)
    right-footer:  ($right-footer$)
    start-indent: %body-start-indent%
    input-whitespace-treatment: 'collapse
    quadding: %default-quadding%
    (process-children)))

(element (foil title)
  (let* ((renderas (attribute-string "renderas"))
	 (hlevel 1)                   
	 (hs (HSIZE (- 4 hlevel))))
    (make paragraph
      font-family-name: %title-font-family%
      font-weight:  (if (< hlevel 5) 'bold 'medium)
      font-posture: (if (< hlevel 5) 'upright 'italic)
      font-size: hs
      line-spacing: (* hs %line-spacing-factor%)
      space-before: (* hs %head-before-factor%)
      space-after: (* hs %head-after-factor%)
      start-indent: (if (< hlevel 3)
			0pt
			%body-start-indent%)
      first-line-start-indent: 0pt
      quadding: 'center
      keep-with-next?: #t
      (process-children))))

(element (foil subtitle)
  (let* ((renderas (attribute-string "renderas"))
	 (hlevel 2)                   
	 (hs (HSIZE (- 4 hlevel))))
    (make paragraph
      font-family-name: %title-font-family%
      font-weight:  (if (< hlevel 5) 'bold 'medium)
      font-posture: (if (< hlevel 5) 'upright 'italic)
      font-size: hs
      line-spacing: (* hs %line-spacing-factor%)
      space-before: (* hs %head-before-factor%)
      space-after: (* hs %head-after-factor%)
      start-indent: (if (< hlevel 3)
			0pt
			%body-start-indent%)
      first-line-start-indent: 0pt
      quadding: 'center
      keep-with-next?: #t
      (process-children))))

(element section
  (process-children))

(element (section title)
  (empty-sosofo))

(define (named-formal-objects)
  (list (normalize "figure")
	(normalize "equation")))

</style-specification>

<external-specification id="docbook" document="docbook.dsl">
4.

String->character nodes

Brandon Ibach and Norm Walsh


/ Brandon Ibach <bibach@infomansol.com> was heard to say:
| (define (string->nodes s)
|   (let ((doc (string-append "&#60;literal>&#60;!DOCTYPE doc [ &#60;!ELEMENT "
|                             "doc - - (#PCDATA)> ]>&#60;doc>" s "&#60;/doc>")))
|     (children (node-property 'docelem (sgml-parse doc)))))

Thanks! I wound up with

(define (string->nodes s)
  ;; Escape XML characters...
  (let* ((achars (string-replace s "&#38;" "&#38;#38;#38;"))
	 (bchars (string-replace achars "&#60;" "&#38;#38;#60;"))
	 (cchars (string-replace bchars "&#62;" "&#38;#38;#62;")))
    (let ((doc (string-append "&#60;literal>&#60;!DOCTYPE doc [ &#60;!ELEMENT "
			      "doc - - (#PCDATA)> ]>&#60;doc>" cchars ";&#60;/doc>")))
      (children (node-property 'docelem (sgml-parse doc))))))

so that markup characters in the string wouldn't cause the parser to barf. This will still fail, I think, if the string contains characters not in the character set of the SGML declaration in effect, but I'm not sure what to do about that.