The move to custom XML

Matthias Benkmann matthias at winterdrache.de
Thu May 22 13:50:48 PDT 2003


On Wed, 21 May 2003 13:32:39 -0600 Gerard Beekmans
<gerard at linuxfromscratch.org> wrote:

> On May 19, 2003 05:44 pm, Matthias Benkmann wrote:
> > Avoiding attributes also allows me to use my  foo{...}  shorthand as
> > in
> >
> > section{  title{Some title}
> >   p{
> >     This is a keyword{paragraph}.
> >   }
> > }
> 
> Say the book is written in such a style, how would this be parsed then?
> Do you convert this to XML and from XML to whatever output format (html
> or text for instance)?

I have written a script brace2xml that converts this to the standard
notation. It even supports attributes by the way, e.g.

"See  a{the LFS homepage href[http://www.linuxfromscratch.org]} for more
information."

would be converted to

"See the <a href="http://www.linuxfromscratch.org">the LFS homepage</a>
for more information."

All further processing deals only with the standard notation.
The location of the attribute within the braces is unimportant, btw.
I don't have a script for converting the standard notation to the brace
notation, although that would of course be just as easy. It's just that
I've never needed it.


I have also developed a nice short-hand notation for XSLT, e.g.

/* the following tags should appear in the output as tags */
template{ match "br|h1|h2|h3|h4|h5|h6"  priority "-1"
  copy{
    for-each{ select "@*" copy }
    apply-templates
  }
}

template{ match "COPYRIGHT-NOTICE"
  <p class="copyright">
    apply-templates
  </p>
}


This makes it look much more like a programming language (which it is
after all).
Again I've written a script (called pretty-xsl) that converts this to the
standard notation.

MSB

-- 
Democracy is when the people has the right to make the wrong choices.

-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-dev' in the subject header of the message



More information about the lfs-dev mailing list