XLink - where are we? [tiny amount of frustration]
W. Eliot Kimber
eliot at dns.isogen.com
Sat Nov 14 05:31:53 GMT 1998
At 09:03 PM 11/11/98, Peter Murray-Rust wrote:
>I am probably tilting at windmills but I am attempting something like this
>in JUMBO - I have about 5 approaches to styles without stylesheets.
>(a) redisplay it as raw XML. Not as silly as it sounds for many documents.
>(b) pretty-print it and display as XML. Extremely useful for many documents
>(c) Reformat start tags as bold and add NL after PCDATA. Works pretty well
>for many documents.
>(d) map every element onto a Java class.
>(e) allow the user to customise some or all elements with styles. I shall
>use Swing for the rendering. Then, I suppose I could write the styles out
>as XSL if anyone cares.
Below is a DSSSL style sheet that implements a simple form of option (b). I
have tested this with the latest HyBrick and with Jade. It should be
usable by itself (no other catalog configuration needed). Choose it as the
style for those documents that don't already have one. It's simple enough
that you should be able to figure out how to adjust it to your own taste
without having the DSSSL spec to hand.
Note that HyBrick's Xlink support doesn't require any style work, so
documents using this style sheet will still exhibit their Xlink-defined
behavior.
Cheers,
E.
--- cut here ---
<!doctype dsssl-spec [
<!element dsssl-spec o o
(char-repertoire?, style-specification,
(style-specification|external-specification)*)>
<!ATTLIST dsssl-spec
id
ID
#IMPLIED
>
<!element style-specification o o (style-specification-body)>
<!element style-specification-body o o (#pcdata)>
<?IS10744 ArcBase dsssl>
<!notation dsssl PUBLIC
"ISO/IEC 10179:1996//NOTATION DSSSL Architecture Definition Document//EN">
<!entity % dssslDtd system "dsssl.dtd">
<!attlist #notation dsssl
ArcDocF NAME #FIXED dsssl-specification
ArcDTD CDATA "%dssslDtd"
ArcQuant CDATA "NAMELEN 64"
>
<?stylesheet href="tagview.dsl" type="text/dsssl">
]>
<dsssl-spec id="foo">
;------------------------------------------------------------
; "Tag View" DSSSL Spec. Provides a default style for
; SGML or XML documents.
;
; Author: W. Eliot Kimber
;
;
; Change History:
;
; $Header$
;
; $Log$
;
;--------------------------------------------------------------------------
(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 midnight-blue-color
(color *rgb-color-space* (/ 25 255) (/ 25 255) (/ 112 255)))
(define primary-blue-color
(color *rgb-color-space* (/ 25 255) (/ 25 255) (/ 255 255)))
(define sea-green-color
(color *rgb-color-space* (/ 46 255) (/ 139 255) (/ 87 255)))
(define red-color
(color *rgb-color-space* (/ 255 255) (/ 0 255) (/ 0 255)))
;--------------------------------------------------
; Define general-purpose functions:
;--------------------------------------------------
(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))))))
(define (ancestors nl)
(node-list-map
(lambda (snl)
(let loop
((cur (parent snl))
(result (empty-node-list)))
(if (node-list-empty? cur)
result
(loop (parent cur)
(node-list cur result)))))
nl))
(define (copy-string string count)
(let loop ((resultstr "")
(count count))
(if (equal? count 0)
resultstr
(loop (string-append resultstr string)
(- count 1)))))
(declare-initial-value font-family-name "iso-monospace")
(root
(make scroll
(process-children)))
(default
(let ((indent
(copy-string
" "
(node-list-length (ancestors (current-node))))))
(sosofo-append
(make paragraph
color: sea-green-color
(literal
indent
"<"
(gi (current-node))
(copy-attributes (current-node) (string-append indent " "))
">"))
(make paragraph
lines: 'asis
(process-children))
(if (node-property 'must-omit-end-tag? (current-node))
(empty-sosofo)
(make paragraph
color: sea-green-color
(literal
indent
"</"
(gi (current-node))
">"))))))
;--- end of spec
--
<Address HyTime=bibloc>
W. Eliot Kimber, Senior Consulting SGML Engineer
ISOGEN International Corp.
2200 N. Lamar St., Suite 230, Dallas, TX 75202. 214.953.0004
www.isogen.com
</Address>
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev
mailing list