;----------------------------------------------------------------------------- ; sgml2htmlpre.xom ; ; Omnimark script to preprocess an SGML document in conjunction with SGML to ; HTML processing. ; ; This counts the sect1 elements within each chapter element and modifies the ; source document such that a processing instruction is ; written immediately following the chapter start tag. This is used in ; determining when the last sect1 is being processed so that proper "next" ; icons and jumps can be generated. ;----------------------------------------------------------------------------- ; (c) Copyright 1996 Novell, Inc. ; All rights reserved. ; ; This program is an unpublished copyrighted work which is proprietary ; to Novell, Inc. and contains confidential information that is not to ; be reproduced or disclosed to any other person or entity without ; prior written consent from Novell, Inc. in each and every instance. ; ; No part of this file may be duplicated, revised, translated, ; localized or modified in any manner or compiled, linked or uploaded ; or downloaded to or from any computer system without prior written ; consent of Novell, Inc. ; ; WARNING: Unauthorized reproduction of this program as well as ; unauthorized preparation of derivative works based upon the program ; or distribution of copies by sale, rental, lease or lending are ; violations of federal copyright laws and state trade secret laws, ; punishable by civil and criminal penalties. ;----------------------------------------------------------------------- down-translate ;Macros macro process-atts is repeat over attributes as this-att do unless attribute this-att is implied set buffer A to key of attribute this-att output " %lg(A)=%"%lv(this-att)%"" done again macro-end macro process-content is set buffer CHAP-INFO to "%c" output "<%lq" process-atts output ">%n" output "%g(CHAP-INFO)%n" reset COUNT to 0 macro-end ;Globals global stream CHAP-INFO global counter COUNT global stream A global stream S global counter XCOUNT global stream TITLCONT global stream BOOK-INFO global counter PREFCNT global counter CHAPCNT global counter APPXCNT DOCUMENT-START set buffer CHAP-INFO to "" reset COUNT to 0 put #OUTPUT "%n" put #OUTPUT "%%localentities;%n]>%n" element BOOK reset CHAPCNT to 0 reset PREFCNT to 0 reset APPXCNT to 0 set buffer BOOK-INFO to "%c" output "<%lq" process-atts output ">%n" output "%n" output "%n" output "%g(BOOK-INFO)%n" element CHAPTER increment CHAPCNT by 1 process-content element APPENDIX increment APPXCNT by 1 process-content element PREFACE increment PREFCNT by 1 process-content element SECT1 increment COUNT output "<%lq" process-atts output ">%c" output "" element #IMPLIED output "<%lq" process-atts output ">%c" output "" when content isnt (empty or conref) output "%n" when content is element DOCUMENT-END output "%n" processing-instruction "nov sect1count " any* = text reset XCOUNT to "%x(text)" output "<*** XCOUNT: %d(XCOUNT)***>%n" processing-instruction any* = text output "" external-data-entity #implied output "&%q;" translate entity named any* = entity-name output "&%x(entity-name);"