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?"
  #t)

In the "isonum.ent" entity file:

<!-- Character entity set. Typical invocation:
     <!ENTITY % ISOnum PUBLIC
       "ISO 8879-1986//ENTITIES Numeric and Special Graphic//EN">
     %ISOnum;
-->
<!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]">
]>
<doc>
AT&amp;T is a large company.
</doc>


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?"
  preserve)

(element doc
    (make element
        gi: "P"
        (process-children)))

; end of file

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

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

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



--
G. Ken Holman            mailto:gkholman@xxxxxxxxxxxxxx
Crane Softwrights Ltd.  http://www.CraneSoftwrights.com
1605 Mardick Court, Box 266,         V: +1(613)489-0999
Kars, Ontario CANADA K0A-2E0         F: +1(613)489-0995
PGP Privacy: http://www.cyberus.ca/~holman/gkholman.pgp
Training:  http://www.CraneSoftwrights.com/schedule.htm

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


Current Thread