Re: relaxng-driven editing

David Tolpin <[email protected]>
Newsgroups gmane.text.xml.relaxng.general
Message-ID <[email protected]>
> > 1) not just the set of first elements in a pattern, but a set of
> > all elements of particular kind (block-level text markup -- para,
> > title, term, listitem) which do not have the opening tag of a
> > preceding element in this pattern.
> 
> I don't understand what you mean by "have the opening tag of a preceding
> element in this pattern".

In the derivative.  In other words,  any element that is the first block-level
markup element following the current context is allowed. This is how text documents
are normally entered, in my opinion. That is, one types the text, not the markup;
if a new chapter should be started, one types its title. The editor then recognizes
that it can be a title, offers to markup it as such (with other variants being
para or term, for example) and adds structural markup between the previous paragraph
and the current title as </section><section>, for example.

I have a proof-of-concept implementation of this approach
(http://davidashen.net/preti.html), which works for subsets of
docbook, xhtml and DITA; however, the algorithm to determine
structurally allowed elements and derive the group-level markup is
ugly.

Actually, writing a message helps understand the issue
better; I am now feeling I roughly understand the algorithm I need, 
and, you are right indeed, it should be based on computing derivatives.

> >       <listitem>
> >     </itemizedlist>
> >     (<para>|<itemizedlist><listitem/>+</itemizedlist>)
> >   </section>*
> >   <section>
> >     <title>
> >     ...
> 
> Is this a description of a content model or an instance or both?

This is a description of a content model (I forgot asterisk after <listitem> - and sorry
for the syntax, rnc would be more readable but I needed something that shows opening and closing
tags separately); this is a derivative after  a listitem is entered.

> 
> > should bring '(listitem para title).
> 
> Why?

Because the user does not enter markup. It enters text and then confirms, alters or rejects
tags which are offered by the program. 

> 
> > 2) other contexts where b indirectly follows a, to decide whether it is appropriate to
> > offer to close a group and/or open a new one.
> 
> So you are currently in a chapter element, say, and you get a paragraph
> of text indicative of the start of a section and you need to decide
> whether to close the chapter before opening the section?  Is that the
> problem? Why can't you do this on the basis of parent/child
> relationships i.e. leave the chapter open iff the chapter can contain a
> section?

You are right; however, if I am inside a listitem and get a title, I need to close  the item,
the list, then open a new section (or chapter - the user decides).  Whether I should close the
current section is a question the user should answer, because sections can be nested.

I see now that I can compute context based on derivatives. My problem with it is that
it is more convenient for the user to first confirm opening of a new group, then to deal
with closing current groups.

<para/>.<title/>-> <para/>.<section><title/> -> <para/></section>.<section></title> ->
                <para/></section></section>.<section><title>

But look like I can simply visit the nodes fro right to left, children first, to get
this sequence for the elements to open.

> 
> I don't think I'm going to be able to help without a lot more detail
> about the problem you're trying to solve.
> 

You are already helping, thank you.

David Tolpin
http://davidashen.net/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.