Re: (dsssl) Dynamic defines

Subject: Re: (dsssl) Dynamic defines
From: "Christopher R. Maden" <crism@xxxxxxxxxx>
Date: Wed, 28 Feb 2001 11:17:57 -0800
hAt 08:19 27-02-2001, Jany Quintard wrote:
En réponse à Devin Weaver <ktohg@xxxxxxxxxxxxx>, qui a écrit:
> To be a bit clearer I rewrote it to look like this:
>     (define (%show-comments%)
>       (equal? "draft"
>         (attribute-string "status" (tree-root (current-node)))))
>
> Question is "DRAFT" and  "STATUS" case sensitive?

I believe it depends on the SGML declaration.

Yes - and it also depends on what the string in question is declared as. The first argument to (attribute-string) is the name of the attribute, which is an SGML Name. Names are normalized according to the SGML Declaration in effect. However, the value of the attribute (here compared to "draft") might be declared as CDATA, or it might be NMTOKEN, NAME, NAMES, NMTOKENS, or an enumerated list of tokens. In the latter cases, the value will be normalized; in the former, it will not. The function below is intended for use whenever the unknown object of comparison is of a type that gets normalized.


See the (normalize string)
function which is in the modular stylesheets :

(define (normalize str)
  (if (string? str)
      (general-name-normalize str
                              (current-node))
      str))

The effect here is to normalize the string according to whatever SGML Declaration is in effect. It was written so that a single DocBook stylesheet could process DocBook/SGML and DocBook/XML documents agnostically. (Originally, it was called (norm), but I guess Norm didn't like that...)


-Chris
--
Christopher R. Maden, XML Consultant
<URL: http://crism.maden.org/consulting/ >


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


Current Thread