Indent problem

Subject: Indent problem
From: "Didier PH Martin" <martind@xxxxxxxxxxxxx>
Date: Tue, 16 Feb 1999 21:55:22 -0500
Hi,

Here is the problem: I want to display a SGML or XML document with markups
displayed with their properties and the content displayed in these markups.
Actually, The included script that does that but the problem is to indent
the markups to show the markups hierarchical relationships. Each markup is a
paragraph object. I need to set the "start-indent" property to a value that
reflect the markup position within the hierarchy. So that it would be
possible to see the markups hierarchy and their content.

Here is the dsssl code that works already but without indentation.This
script is inspired from Eliot Kimber tagview script.
<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN">

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

(define *rgb-color-space*
  (color-space "ISO/IEC 10179:1996//Color-Space Family::Device RGB"))

(define sea-green-color
  (color *rgb-color-space* (/ 46 255) (/ 139 255) (/ 87 255)))

(define (copy-attributes nd indent)
  (let loop ((atts (named-node-list-names (attributes nd)))
             (resultstr ""))
    (if (null? atts)
        resultstr
        (loop
          (cdr atts)
          (let* ((name (car atts))
                 (value (attribute-string name nd)))
            (if value
              (string-append
                resultstr
                "&#RE;"
                indent
                name
                "=\""
                value
                "\"")
              resultstr))))))

(root
  (make scroll
    (process-children)))

(default
      (sosofo-append
      (make paragraph
        color: sea-green-color
        (literal
          "<"
          (gi (current-node))
          (copy-attributes (current-node) (string-append "  "))
          ">"))
      (make paragraph
        lines: 'asis
        (process-children))
      (if (node-property 'must-omit-end-tag?   (current-node))
        (empty-sosofo)
        (make paragraph
          color: sea-green-color
          (literal
            "</"
            (gi (current-node))
            ">")))))



 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread