| 1. | DSSSL external references |
Check this lists archives, but also try: Mulberrytech.com, uwaterlool.ca and cs.uni.magdeburg.de | |
| 2. | jade:entities/iso-amsr.ent:7:18:E: "X224D" is not a function name |
One of the features of jade is that it handles SGML as well as XML. In order to do that it has two features which help. Firstly, it can handle multiple XML files, second it can manage a seperate declaration, which means that it will treat certain features (including the problem mentioned above) by the inclusion, prior to your main xml file, of a special file called xml.dcl, which is included in either jade or openjade distribution. You don't need to know what it does, simply that including it as well, and prior to, your xml file will resolve such issues as this. Find the file and include it, as per the example below, changing paths as necessary for your installation. The standard distribution puts it in dtds/decls/xml.dc, wherever you installed that.
Thats all it takes to remove these errors. Below is the line I use in a script to process my DocBook.xml files. All on one line of course jade -t rtf -d d:\XML\sgml\stylesheets\db173\print\docbook.dsl And, if the tools are calling Jade you will have to add the SGML entities files to a catalog file. Incidentally, the docbook-utils package (redhat) spots which decl file to use automatically, based on whether the input has an xml pi. | |
| 3. | SGML character entities |
I recently discovered that I ought to be using the SGML character entities, if I'm using DSSSL (yup, the 'ol "X00E1" is not a function name error). Once I discovered that I needed these entities, I reviewed all the documents I knew of, which describe installing DocBook, and couldn't find any pointer to the SGML ISO character entities. To fix the above error, all I had to do was install the entity definition files, which take the form 'iso-*.gml', (though the ones I found are potentially stale, which is why I'm asking) and create a catalog file that maps each PUBLIC identifier for one of these files to the SGML version. Then, I placed the path to this file in my SGML_CATALOG_FILES environment variable, *before* the docbook.cat that was included with the XML DTD. I don't know whether the first PUBLIC -> SYSTEM identifier mapping is supposed to take precedence over any following ones, but it seems to work this way with OpenJade 1.3. (I just thought I'd write up the above paragraph, as I had surprising difficulty finding this information in the mailing list archives, though maybe I was just unlucky in which of my search hits I chose to read, first.) Oasis Cover pages provides the iso entity sets. | |
| 4. | Where is Open Jade hosted? |
For more info about Open Jade, see http://www.netfolder.com/DSSSL/ | |
| 5. | DSSSL stylesheet parameter explanations |
The print and HTML stylesheet parameters are documented here, for print and here, for html | |
| 6. | How do I customize the default stylesheets? |
In chapter 4 of DocBook; TDG you'll find a section covering this topic. In short: write your own driver file, e.g.:
and use this stylesheet file for processing your source file with (open)jade (providing the stylesheet pathname as a command line option like -d ./mystyle.dsl). Choose the corresponding part for HTML or print output by setting the variable print or html using the command line option -i (e.g. -i print). | |
| 7. | How do I include images? |
tbd. | |
| 8. | How do I center images in print output? |
Add the following to your customization stylesheet: (element imagedata (This is a bug in the default stylesheets which will be resolved in the near future) | |
| 9. | Which tools are best for converting graphic files to other formats? |
There are for sure many possible solutions, but most
people would like to try | |
| 10. | How do I generate an index? |
Very short description:
| |
| 11. | Can I include sect1 titles in a print header |
You can't. DSSSL only allows the headers and footers to be established once for each simple-page-sequence (in this case, for each chapter). Using multiple s-p-s's would introduce page breaks that you probably don't want. | |
| 12. | Can I put the filename in the footer |
The filename isn't available to Jade, so I don't think you can easily do that. But to change headers and footers in general, see dbcompon.dsl. | |
| 13. | Appendices and bibliographies on seperate page |
I have done that for appendices. It requires modifying the handling of article, and the handling of appendices. This sample code may help you - I hope it's OK when out of context - the full file will be released at https://savannah.gnu.org/projects/alcovebook/ Indeed what this does is providing an %article-section-starts-new-page% flag, which controls that for all section-level elements, including glossary and such. There are also many features in that, some of which maybe not optimally implemented - hopefully all changed code should be tagged as such. The reference code was 1.72, I did not upgrade it yet.
| |
| 14. | Styling html output from DSSSL |
You can do this if you put the source code inside <screen> tags and add the following to your custom stylesheet (element tgroup
(let* ((wrapper (parent (current-node)))
(frameattr (attribute-string (normalize "frame") wrapper))
(pgwide (attribute-string (normalize "pgwide") wrapper))
(footnotes (select-elements (descendants (current-node))
(normalize "footnote")))
(border (if (equal? frameattr (normalize "none"))
'(("BORDER" "0"))
'(("BORDER" "1"))))
(bgcolor '(("BGCOLOR" "#E0E0E0")))
(width (if (equal? pgwide "1")
(list (list "WIDTH" ($table-width$)))
'()))
(head (select-elements (children (current-node)) (normalize "thead")))
(body (select-elements (children (current-node)) (normalize "tbody")))
(feet (select-elements (children (current-node)) (normalize "tfoot"))))
(make element gi: "TABLE"
attributes: (append
border
width
bgcolor
'(("CELLSPACING" "0"))
'(("CELLPADDING" "4"))
(if %cals-table-class%
(list (list "CLASS" %cals-table-class%))
'()))
(process-node-list head)
(process-node-list body)
(process-node-list feet)
(make-table-endnotes))))
;;Should verbatim items be 'shaded' with a table?
(define %shade-verbatim%
#t)
;;Define shade-verbatim attributes
(define ($shade-verbatim-attr$)
(list
(list "BORDER" "0")
(list "BGCOLOR" "#E0E0E0")
(list "WIDTH" ($table-width$))))
| |
| 15. | Float images |
Yes, it's a very well known problem I'm afraid. Using tables doesn't work neither with rtf nor tex. So it has been said that "FLOAT IMAGES ARE NOT SUPPORTED". Anyway, the folks of Mandrake have made a customization of Jadetex and the DSSSL to allow text wrap along one side of an image. See: mandrake | |
| 16. | Change justified text |
In your customization driver file (see dssslgeneral.html#custom for further details) add the follwing: (define %default-quadding% 'start) See also dssslpdf.html#justified. One last thing: I'm not sure how to chain the customization drivers as you already seem to use the one from the LDP. A wild guess would be to make your own and let it point to ldp.dsl. OTOH, if ldp.dsl is located in your home dir you might as well insert/replace the necessary line right there. | |
| 17. | Remove bold on figure titles |
In HTML, I think this will work. Something roughly isomorphic should do the trick in print. (define ($formal-object$ #!optional (rule-before? #f) (rule-after? #f))
(let* ((nsep (gentext-label-title-sep (gi)))
(id (element-id))
(title-inline-sosofo
(make sequence
(make element gi: "B"
(if (member (gi) (named-formal-objects))
(make sequence
(literal (gentext-element-name (gi)))
(if (string=? (element-label) "")
(literal nsep)
(literal " " (element-label) nsep)))
(empty-sosofo)))
(with-mode title-mode
(process-node-list
(select-elements (children (current-node))
(normalize "title"))))))
(title-sosofo (make element gi: "P"
title-inline-sosofo)))
(object-sosofo (process-children)))
(make element gi: "DIV"
attributes: (list
(list "CLASS" (gi)))
(if rule-before?
(make empty-element gi: "HR")
(empty-sosofo))
(if id
(make empty-element gi: "A"
attributes: (list
(list "NAME" id)))
(empty-sosofo))
(if (object-title-after)
(make sequence
object-sosofo
title-sosofo)
(make sequence
title-sosofo
object-sosofo))
(if rule-after?
(make empty-element gi: "HR")
(empty-sosofo)))))
| |
| 18. | SGML character entities (xxxx not a function error) |
I recently discovered that I ought to be using the SGML character entities, if I'm using DSSSL (yup, the 'ol "X00E1" is not a function name error). Once I discovered that I needed these entities, I reviewed all the documents I knew of, which describe installing DocBook, and couldn't find any pointer to the SGML ISO character entities. BTW, To fix the above error, all I had to do was install the entity definition files, which take the form 'iso-*.gml', (though the ones I found are potentially stale, which is why I'm asking) and create a catalog file that maps each PUBLIC identifier for one of these files to the SGML version. Then, I placed the path to this file in my SGML_CATALOG_FILES environment variable, *before* the docbook.cat that was included with the XML DTD. I don't know whether the first PUBLIC -> SYSTEM identifier mapping is supposed to take precedence over any following ones, but it seems to work this way with OpenJade 1.3. | |
| 19. | SDATA entities don't work in XML document |
Just define the entities to be the unicode equivalents (  in the case of nbsp) You'll find XML versions of the standard entity sets in lots of places (some of them even agree on the unicode mappings:-) The mathml spec comes with some: http://www.w3.org/TR/MathML2/DTD-MathML-20010221.zip for example, as does docbook, I believe. | |
| 20. | How to put images in document header elements |
Try this: (define (page-inner-header gi)
(cond
((equal? (normalize gi) (normalize "dedication")) (empty-sosofo))
((equal? (normalize gi) (normalize "lot")) (empty-sosofo))
((equal? (normalize gi) (normalize "part")) (empty-sosofo))
((equal? (normalize gi) (normalize "toc")) (empty-sosofo))
(else
(make sequence
font-size: 2.54cm
(make external-graphic
display?: #f
entity-system-id: "C:/logos/mylogo.pdf"
max-width: 2.54cm
max-height: 2.54cm
))))) | |
| 21. | DSSSL text justification for html output |
%default-quadding% (for the html stylesheets) specifies the value of the "ALIGN" attribute of the <P> tag in the HTML. i.e it is not a DSSSL attribute! It defaults to "#f" which means "don't generate an align tag at all" otherwise it can be "left", "center", "right", "justify". So you should have (define %default-quadding% "left") which will cause the paragraph to be generated with <P ALIGN="left"> Of course, you should, nowadays, use CSS to set an appropriate attribute with a stylesheet: (define %stylesheet% and leave %default-quadding% as #f. | |
| 22. | legalnotice style change, dsssl. |
I think you want to use <legalnotice> and leave the stylesheet alone. If all you want is to center the title, override the form (mode formal-object-title-mode (element title ...)) seen in file dbblock.dsl. | |
| 23. | Using RTF stylenames |
There's the heading-level characteristic described at: jclark.com And it works for PDF too (TeX backend). With it you can have the bookmarks. | |
| 24. | Numbering sect1 sections |
From dbpara.dsl
Change it to #t | |
| 25. | footnote formatting in DSSSL |
Well I searched my SuSE system and and found the following part (just kidding I do not know where I found this sowehere on the web ) This is for the footer rule (define ($custom-header-footer$)
(let ((component (ancestor-member (current-node)
(append (division-element-list)
(component-element-list)))))
(make sequence
font-weight: 'bold
font-posture: 'upright
(make rule
orientation: 'horizontal
length: %text-width%
line-thickness: 1pt
start-indent: 0pt
space-before: (/ %block-sep% 4))
(literal "For internal use only"))))
(define (page-inner-footer gi)
(empty-sosofo))
(define (page-center-footer gi)
(cond
((equal? (normalize gi) (normalize "dedication")) (empty-sosofo))
((equal? (normalize gi) (normalize "lot")) (empty-sosofo))
((equal? (normalize gi) (normalize "part")) (empty-sosofo))
((equal? (normalize gi) (normalize "toc")) (empty-sosofo))
(else ($custom-header-footer$))))
| |
| 26. | Two sided output in dsssl |
If you are using reasonably recent DSSSL modular stylesheets, openjade
and jadetex then you can use the characteristic
which can either be true of false (#t or #f). Probably putting the following in your driver file is the easiest way to do it: (declare-characteristic two-side-start-on-right? "UNREGISTERED::OpenJade//Characteristic::two-side-start-on-right?" #f) | |
| 27. | Specify utf-8 encoding on html output |
You can include following code into your customization layer: (define %html-header-tags%
'(("META" ("HTTP-EQUIV" "Content-Type") ("CONTENT" "text/html;
charset=utf-8"))))
This will insert meta tag with encoding information into each generated HTML file. Most browsers take encoding information from this place (but you must be careful when serving pages from web-server, encoding information served in HTTP headers has higher priority) and will change encoding automatically. | |
| 28. | Including PHP in HTML output |
Right. The driver file here is laszlo.dsl. However, a specific portion of that file is being singled out with the "#html" part of the argument to the -d option. You should find a line something like: <style-specification id="html" use="docbook"> in laszlo.dsl. The code inside this tag is the stylesheet being used. Any customizations you provide need to go inside of it. > What I'm trying to output is not HTML tags, but PHP code, surrounded by The designers of PHP were smart. The construct that is used to embed PHP code in an HTML page is an XML "processing-instruction", which looks like: <?target blah,blah?> The "target" is an XML-ism to provide a little more structure to PIs than SGML had. XML also adds the question mark at the end (just before the ">" sign), where SGML did not have this. Because your "make html" command is invoking the XML backend of OpenJade (the "-t xml" option), you can use the following to produce PHP code: (make processing-instruction data: "php ...") You will need to take care with your PHP code (inserted in place of the ..., above), as certain characters, mainly <, > and &, can cause problems, depending upon how your stylesheet is structured, but I think you touched on that already with a CDATA section. As for what code to override, you'll probably want to redefine the html-document function from dbhtml.dsl (about 60 lines down in the file, in my copy of Norm's stylesheets). There's some kind of complex stuff going on in this function with chunking (breaking the output into multiple files), header generation, etc, so be careful. ;) Ian Castle adds You want a "processing-instruction" for example: <!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN"> <style-sheet> <style-specification> <style-specification-body> (declare-flow-object-class processing-instruction "UNREGISTERED::James Clark//Flow Object Class::processing-instruction") (element book (make processing-instruction data: "php myphpstatement") ) </style-specification-body> </style-specification> </style-sheet> Would generate <?php myphpstatement?> | |
| 29. | Including special characters in DSSSL |
There are several ways to represent any given character. For just a single character (not a string), a la '\t' in C, you would use the #\U-0009 syntax. In a string, a la "This \t is a tab" in C, you would use "This \U-0009; is a tab". The word after the slash in either case can be either the ISO 10646 name in lower-case with hyphens between words (for some characters, anyway), or U-XXXX, where XXXX is the 16-bit Unicode value in four upper-case hexadecimal digits, such as 0000 for null or 0009 for tab. I can imagine a variety of reasons for wanting a tab character in your DSSSL script, but I can't imagine a need for the null character, unless you're somehow reading or writing non-SGML data... I hope this helps. If not, some more information on what you're looking to accomplish would help. > For example: That's right.
Honestly, I don't know offhand what effect this would have in formatted output. How would the formatter (such as TeX) know how much to indent the paragraph when it sees the tab character? If you really don't want to use "first-line-start-indent", how about a line-field object? (element para
(make paragraph
(make line-field field-width: 1cm)
(process-children)))
> If I want to insert an hidden caracter in my paragraph Yes, I agree with your approach, however, why not just:
(element simpara
(if (string=? "" (data (current-node)))
(make paragraph
break-before: 'page
(literal " "))
(make paragraph
(process-children))))
How is the "hidden character" that you had in mind different from a character that makes no mark upon the page, like a space? Playing with control characters (such as the null, or 0) that are outside of the normal range dealt with in SGML is likely to cause problems. | |
| 30. | Sort a node list |
Yes, take a 'basic' quicksort procedure on lists, abstract it in order to create a generic factory procedure for 'quicksorting' collections and call this generic procedure using the basic functions on node-lists. You'll find an example at the end of this message :) But I found the node-list-sort procedure defined below rather inefficient (because of the constructor node-list ?) and preferred to do the following :
(define (node-list-sort nl)
(list->node-list
(list-sort
(node-list->list nl))))
; 1- quicksort-maker : a generic quicksort procedure factory on abstract collections :
(define (quicksort-maker cons null? car cdr append empty)
; cons --> add an element to a collection
; null? --> empty collection predicate
; car --> head of the collection
; cdr --> rest of the collection
; append --> concat two collections
; empty --> the empty collection
(letrec
((collect
(lambda (pivot ls lgroup rgroup less?)
(if (null? ls)
(append (quicksort lgroup less?)
(cons pivot (quicksort rgroup less?)))
(if (less? pivot (car ls))
(collect pivot (cdr ls) lgroup (cons (car ls) rgroup) less?)
(collect pivot (cdr ls) (cons (car ls) lgroup) rgroup less?)))))
(quicksort
(lambda (ls less?)
(if (or (null? ls) (null? (cdr ls)))
ls
(collect (car ls) (cdr ls) empty empty less?)))))
quicksort))
; 2- a list sorting procedure : (define list-sort (quicksort-maker cons null? car cdr append '())) ; 3- a node-list sorting procedure : (define node-list-sort (quicksort-maker node-list node-list-empty? node-list-first node-list-rest node-list (empty-node-list))) |