Re: Another newbie question...

Subject: Re: Another newbie question...
From: Graydon Hoare <graydon@xxxxxxxxxxx>
Date: Fri, 29 Aug 1997 11:34:52 -0400 (EDT)
On Fri, 29 Aug 1997, Vu Nguyen wrote:

> how would I do that? Forexample, I have a document like this:
>   <MyDiary date="...">
>   <Text>
>     ....
>   </Text>
>   </MyDiary>
> 
>   I want to get the date attribute at any time not just when I process the
> MyDiary element... how would I do that and is it possible?? I noticed that

the thing is, the gi (generic identiffier) "MyDiary" may occur in more
than one place in your grove, so it's really not reasonable to try
'fetching' a node with only a gi, you can't do that in dsssl ;)  However,
you can navigate around in the grove using a variety of methods.  for
instance, if you are processing the aforementionned <text> node, and you
suddenly feel curious about the <MyDiary> node which contains it, you can
use (parent (current-node)) to get an osnl referring to it. Thus, you
could extract the attribute-string you're interested in using

(attribute-string "DATE" (parent (current-node)))

but if you just want to jump to the MyDiary node from any old place in the
grove, you need to ensure the MyDiary node has an identifier (an attribute
called "id", with some unique value), and then you can evaluate
(element-with-id id) to get an osnl for the identified node. You can also
move to the root of a grove and then selectively navigate down through the
children -- read the sections on SDQL and NAVIGATION in the DSSSL
standard. 

-graydon <graydon@xxxxxxxxx>


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


Current Thread