[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Texmacs-dev] DOM and TeXmacs roadmap

From: Joris van der Hoeven
Subject: Re: [Texmacs-dev] DOM and TeXmacs roadmap
Date: Tue, 29 Jul 2003 19:07:57 +0200 (CEST)

On Tue, 29 Jul 2003, Immanuel Normann wrote:
> David Allouche wrote:
> > DOM level 1:
> >
> >  Structure navigation: can be implemented quite easily using a
> >    SXML-like approach to the STM (Scheme TeXmacs) document
> >    representation. All STM documents can trivially be considered SXML
> >    documents.
> >
> The SXML project has attrackted me since while. Now I am interested
> about your experience with SXML in TeXmacs. Is there some experimental
> code around where manipulate the STM with some SXSLT for instance?

One should notice that there is a subtle difference between TeXmacs trees
and XML trees: TeXmacs trees do not carry attributes (like in LaTeX).
Rather we have a with primitive for this.

In the future, I want the data format to become more XML compliant though.
Probably, I will insert a new 'attributes' tag one day, which allows
XML Scheme trees to be mapped to TeXmacs trees in a clean way.

The main difficulty with all this is how to deal with data access.
Currently, data is accessed through paths in the tree and
we want to remain compatible with that. On the other hand,
it might be nice to see subtrees as objects for themselves,
like in DOM and have operations on them. The point is to
keep the synchronization with the typesetter. In the future
this will be done by associating to each tree its source path.
I think that this will solve the problem and will allow us to
be both compatible with XML, DOM, etc. and our original conventions.

> >Two ways:
> >  Using STM:
> >    (tree->object (the-buffer))
> >      gives you the STM representation of the current buffer text.
> >
> >    (tm-assign '() (object->tree x))
> >      sets the current buffer from the STM data in x.
> >
> It is quite fun to manipulate the STM with some Scheme functions and
> display it with
> (tm-assign '() (object->tree x))
>> Though I can see a result i do not understand 'tm-assign'. I tried to
> grep the definition of it, but I could not find it. What is the use of
> the first parameter '()?

The path of the subtree you want to modify.
For instance, if your document is

        (document (frac "a" "b"))


        (assign '(0 1) (object->tree "x"))

will result in your document to become

        (document (frac "x" "b"))

> I couldn't find the definitions of 'tree->object' and 'object->tree'

Converts between scheme representation using recursive lists and
the internal representation.

> Eventually I come back with my original question: "How can I access
> nodes of the document tree?"
> Perhaps I didn't understand your answer correctly, but my understanding
> is that I have to take the whole tree, manipulate it and send it back as
> a whole. So isn't it possible to set a subtree of the current buffer?

Using the access paths, like in the above example.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]