[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Subject: Re: DOCBOOK-APPS: indexing for print with DSSSL / OpenJade / JadeTex
> > 2. Modify DSSSL stylesheets to include index marks into generated RTF > > file. [...] > > If you are interested, I can post DSSSL customization > > and PHP script for postprocessing here. > > Thanks for your offer! Please send your customized stuff to this list, > since I think it is useful to a wider audience. OK. But it is not out-of-the box solution. 1. Include this code into your DSSSL customization: (element (indexterm) (make sequence ;; end of range does not produce index entry (if (equal? (attribute-string "class") "endofrange") (make sequence (literal "#be ") (literal (attribute-string "startref")) (literal "#") ) (make sequence ;; common (literal "#xe #") (literal (data-of (select-elements (children (current-node))(normalize "primary")))) ;; handle secondary index (if (node-list-empty? (select-elements (children (current-node))(normalize "secondary"))) (literal "") (make sequence (literal ":") (literal (data-of (select-elements (children (current-node))(normalize "secondary"))))) ) ;; handle see (if (node-list-empty? (select-elements (children (current-node))(normalize "see"))) (literal "") (make sequence (literal "#txe viz ") (literal (data-of (select-elements (children (current-node))(normalize "see"))))) ) ;; handle start of range (make reference to it) (if (equal? (attribute-string "class") "startofrange") (make sequence (literal "#rxe ") (literal (attribute-string "id")) ) (literal "") ) ;; common end (literal "##") ) ) ;; start of range (if (equal? (attribute-string "class") "startofrange") (make sequence (literal "#bs ") (literal (attribute-string "id")) (literal "#") ) (literal "") ) ) ) (element index (make paragraph (literal "#index#"))) 2. Now generate RTF with the customized stylesheet. In places, where you have indexterms, there will be geberated some strange pieces of text surrounded by #. 3. To tidy RTF you must replace #...# by appropriate RTF codes. This can be done by attached script (it is written in PHP, you will need PHP iterpreter for processing it - http://www.php.net). To tidy file doc.rtf you can invoke script by command like: php -f rtf2rtf.php < doc.rtf > doc2.rtf As script uses only few regular expressions, it would be easy to rewrite it into Perl as this scripting language is more common than PHP. 4. Now you have doc2.rtf. Open it in Word, pres Ctrl-A and then press F9. Index will apear on place where you have <index/> in your DocBook source. This process is able to handle primary and secondary level entries, ranges and see index entries. It can be quite easily extended to cope with all indexterm capabilities of DocBook, but I do not have time to do it and I do not think that this process is proper and elegant way to handle indexes. Just hack. ----------------------------------------------------------------- Jirka Kosek e-mail: jirka@kosek.cz http://www.kosek.cz
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Powered by eList eXpress LLC