|
Subject: Re: Accessing declared value of attribute in Jade From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxx> Date: Mon, 06 Oct 1997 17:48:21 -0400 |
At 16:41 97/10/06 -0400, Daniel Speck wrote:
>I don't know how to access the attribute value token node. Can someone
>give me a pointer?
I modified your data to add a test for the attribute not being present, and
an attribute of the same name but not being of type ENTITY.
I then used the node-property function in order to determine that an
attribute was of type ENTITY. Note that this code fragment assumes only a
single attribute and is not general enough to process all attributes or all
kinds of attributes ... but it should be enough for you to add the
detection of ENTITY to your own program.
Note how one must prepare for the access of a nodal property that does not
exist.
I hope this helps.
..................... Ken
F:\FTEMP>type test.dsl
<!doctype style-sheet PUBLIC "-//James Clark//DTD DSSSL Style
Sheet//EN">
(define debug
(external-procedure "UNREGISTERED::James Clark//Procedure::debug"))
(element test
(process-children))
(default
(let* ((node (current-node))
(attlist (attributes node))
(report1 (debug (gi node)))
(report2
(debug
(string-append
"Attr '"
(node-property 'name attlist) ;name in attribute node
"' is "
(let ((attr-val-nl (node-property 'value
attlist
default: (empty-node-list))))
(if (node-list-empty? attr-val-nl) ;there is no value
"**not specified**" ;so say so
(string-append
(node-property 'token attr-val-nl)
" ("
(let ((attr-val-ent
(node-property 'entity
attr-val-nl
default: (empty-node-list))))
(if (node-list-empty? attr-val-ent)
"**not an entity**"
"ENTITY"))
")")
)))))
)
(empty-sosofo)))
F:\FTEMP>type test.sgm
<!DOCTYPE test [
<!ELEMENT test o o (graphic|junque)+>
<!ELEMENT graphic - o EMPTY>
<!ATTLIST graphic
name ENTITY #implied
>
<!ELEMENT junque - o EMPTY>
<!ATTLIST junque
name NAME #implied>
<!NOTATION tiff SYSTEM "tiff">
<!ENTITY foo SYSTEM "foo.tif" NDATA tiff>
]>
<junque name=hello>
<graphic>
<graphic name=foo>
F:\FTEMP>jade -c %jadedir%catalog -d test.dsl -t rtf test.sgm
C:\PROGRA~1\JADE\CURRENT\JADE.EXE:test.dsl:13:18:I: debug ""JUNQUE""
C:\PROGRA~1\JADE\CURRENT\JADE.EXE:test.dsl:15:0:I: debug ""Attr 'NAME' is
HELLO (**not an entity**)""
C:\PROGRA~1\JADE\CURRENT\JADE.EXE:test.dsl:13:18:I: debug ""GRAPHIC""
C:\PROGRA~1\JADE\CURRENT\JADE.EXE:test.dsl:15:0:I: debug ""Attr 'NAME' is
**not specified**""
C:\PROGRA~1\JADE\CURRENT\JADE.EXE:test.dsl:13:18:I: debug ""GRAPHIC""
C:\PROGRA~1\JADE\CURRENT\JADE.EXE:test.dsl:15:0:I: debug ""Attr 'NAME' is
foo (ENTITY)""
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
DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: Accessing declared value of att, Daniel Speck | Thread | Re: Accessing declared value of att, Daniel Speck |
| Re: Accessing declared value of att, Daniel Speck | Date | Re: Accessing declared value of att, James Clark |
| Month |