Re: Need to stop '&' being translated to '&' by SGML B.E.

Subject: Re: Need to stop '&' being translated to '&' by SGML B.E.
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxx>
Date: Fri, 14 Nov 1997 16:33:24 -0500
At 11:02 97/11/14 +0000, Aidan Killian wrote:
>	I am using the Jade SGML back-end and I am trying to stop 
>it from translating '&'s to '&#38;'.
>	Is there any way to stop those '&#38;'s without resorting 
>to a 'character processing' DSSSL script.

The combination of using the SGML Back End's "preserve-sdata?"
characteristic and ensuring the entity declaration for the amperand is an
SDATA entity will stop the use of "&amp;" from being translated to "&#38;".

In your DSSSL script:

(declare-characteristic preserve-sdata?
  "UNREGISTERED::James Clark//Characteristic::preserve-sdata?"

In the "isonum.ent" entity file:

<!-- Character entity set. Typical invocation:
       "ISO 8879-1986//ENTITIES Numeric and Special Graphic//EN">
<!ENTITY lt     SDATA "[lt    ]"--=less-than sign R:-->
<!ENTITY amp    SDATA "[amp   ]"--=ampersand-->

An example is attached below.

........... Ken

p.s. - note also how the command line can be used to tweak the
characteristic dynamically

F:\FTEMP>type test.sgm
<!DOCTYPE doc [
<!ELEMENT doc - O ( #PCDATA )>
<!ENTITY amp SDATA "[amp]">
AT&amp;T is a large company.

F:\FTEMP>type test.dsl
<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN">

(declare-flow-object-class element
  "UNREGISTERED::James Clark//Flow Object Class::element")

(define preserve #f)

(declare-characteristic preserve-sdata?
  "UNREGISTERED::James Clark//Characteristic::preserve-sdata?"

(element doc
    (make element
        gi: "P"

; end of file

F:\FTEMP>jade -c l:\jade\current\catalog -t sgml test.sgm >test.htm

F:\FTEMP>type test.htm
>AT&#38;T is a large company.</P
F:\FTEMP>jade -c l:\jade\current\catalog -t sgml -V preserve test.sgm

F:\FTEMP>type test.htm
>AT&amp;T is a large company.</P

G. Ken Holman            mailto:gkholman@xxxxxxxxxxxxxx
Crane Softwrights Ltd.
1605 Mardick Court, Box 266,         V: +1(613)489-0999
Kars, Ontario CANADA K0A-2E0         F: +1(613)489-0995
PGP Privacy:

 DSSSList info and archive:

Current Thread