ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* ConTeXt + TEI (an SGML derivate)
@ 2000-04-24 14:00 Tobias Burnus
  2000-04-25 14:09 ` Johannes Hüsing
  0 siblings, 1 reply; 10+ messages in thread
From: Tobias Burnus @ 2000-04-24 14:00 UTC (permalink / raw)


Hi,

I would like to typeset some TEI documents (see
http://etext.lib.virginia.edu/TEI.html and
http://www.uic.edu:80/orgs/tei/ and http://www.tei-c.org/). What's the
best way to proceed? (Ok I could try to write a PERL phraser which
translates everything into ConTeXt constructs, but this doesn't seem to
be the best way.)

Tobias


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ConTeXt + TEI (an SGML derivate)
  2000-04-24 14:00 ConTeXt + TEI (an SGML derivate) Tobias Burnus
@ 2000-04-25 14:09 ` Johannes Hüsing
  2000-04-27  9:29   ` Hans Hagen
  0 siblings, 1 reply; 10+ messages in thread
From: Johannes Hüsing @ 2000-04-25 14:09 UTC (permalink / raw)


On Mon 2000-04-24 (16:00), Tobias Burnus wrote:
> Hi,

Hi,

> 
> I would like to typeset some TEI documents (see
> http://etext.lib.virginia.edu/TEI.html and
> http://www.uic.edu:80/orgs/tei/ and http://www.tei-c.org/). What's the
> best way to proceed? (Ok I could try to write a PERL phraser which
> translates everything into ConTeXt constructs, but this doesn't seem to
> be the best way.)

I currently see two options, both of which take quite some work:

- Convert the TEI source with some style sheet into visual markup which
  is parsed by ConTeXt.

- Re-write the original file, retaining the original structure, but in a 
  ConTeXt syntax. That means: Replace "<mytag>foo bar</mytag>" by
  "\startmytag foo bar\stopmytag". Next, write a module which does the
  TeX formatting.

I would opt for the second version if a stylesheet does not exist. If a
stylesheet exists, I would rather go for plain TeX than ConTeXt as the
output of the style sheet is rather visual than content related.

Greetings

Johannes

> 
> Tobias


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ConTeXt + TEI (an SGML derivate)
  2000-04-25 14:09 ` Johannes Hüsing
@ 2000-04-27  9:29   ` Hans Hagen
  2000-04-27 14:47     ` Johannes Hüsing
  0 siblings, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2000-04-27  9:29 UTC (permalink / raw)
  Cc: NTG-ConTeXt

Hi Tobias and Johannes, 

>> I would like to typeset some TEI documents (see
>> http://etext.lib.virginia.edu/TEI.html and
>> http://www.uic.edu:80/orgs/tei/ and http://www.tei-c.org/). What's the
>> best way to proceed? (Ok I could try to write a PERL phraser which
>> translates everything into ConTeXt constructs, but this doesn't seem to
>> be the best way.)
>
>I currently see two options, both of which take quite some work:
>
>- Convert the TEI source with some style sheet into visual markup which
>  is parsed by ConTeXt.
>
>- Re-write the original file, retaining the original structure, but in a 
>  ConTeXt syntax. That means: Replace "<mytag>foo bar</mytag>" by
>  "\startmytag foo bar\stopmytag". Next, write a module which does the
>  TeX formatting.
>
>I would opt for the second version if a stylesheet does not exist. If a
>stylesheet exists, I would rather go for plain TeX than ConTeXt as the
>output of the style sheet is rather visual than content related.

The last few months I've done quite some experiments with using xsl as well
as perl for going from xml to context (and pdf). I looked at a lot of dtd's
and also at tei. Both methods work ok. 

One way of doing it is to use a simple xslt style sheet that maps elements
onto context commands. In most cases one can ignore attributes, since they
are handled at the style level. Things like: 

<chapter>whatever</chapter>

are mapped by 

<xsl:template match="chapter">
\chapter{<xsl:apply-templates/>}
</xsl:template>

to 

\chapter{whatever}

Hans

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.nl
-----------------------------------------------------------------


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ConTeXt + TEI (an SGML derivate)
  2000-04-27  9:29   ` Hans Hagen
@ 2000-04-27 14:47     ` Johannes Hüsing
  2000-04-27 18:34       ` Tobias Burnus
  2000-04-27 21:28       ` Hans Hagen
  0 siblings, 2 replies; 10+ messages in thread
From: Johannes Hüsing @ 2000-04-27 14:47 UTC (permalink / raw)


On Thu 2000-04-27 (11:29), Hans Hagen wrote:
[...]
> 
> The last few months I've done quite some experiments with using xsl as well
> as perl for going from xml to context (and pdf). I looked at a lot of dtd's
> and also at tei. Both methods work ok. 
> 
> One way of doing it is to use a simple xslt style sheet that maps elements
> onto context commands. In most cases one can ignore attributes, since they
> are handled at the style level. Things like: 
> 
> <chapter>whatever</chapter>
> 
> are mapped by 
> 
> <xsl:template match="chapter">
> \chapter{<xsl:apply-templates/>}
> </xsl:template>
> 
> to 
> 
> \chapter{whatever}
> 
> 

Hans,

would you care to share the fruits of your experiments with us?

Johannes 
(who forgot indeed to activate \write18, sorry)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ConTeXt + TEI (an SGML derivate)
  2000-04-27 14:47     ` Johannes Hüsing
@ 2000-04-27 18:34       ` Tobias Burnus
  2000-04-27 19:57         ` Johannes Hüsing
  2000-04-27 21:25         ` Hans Hagen
  2000-04-27 21:28       ` Hans Hagen
  1 sibling, 2 replies; 10+ messages in thread
From: Tobias Burnus @ 2000-04-27 18:34 UTC (permalink / raw)


Hallo Hans, hallo Johannes, hi all,

> > One way of doing it is to use a simple xslt style sheet that maps elements
> > onto context commands. In most cases one can ignore attributes, since they
> > are handled at the style level. Things like:
> > <chapter>whatever</chapter>
> >
> > are mapped by
> >
> > <xsl:template match="chapter">
> > \chapter{<xsl:apply-templates/>}
> > </xsl:template>
> > \chapter{whatever}
This doesn't seem to work here using TEI (SGML, tei.dtd) and with Java
XT (PR-xslt-19991008) and a selfwritten incomplete stylesheet (XSL).

I get something like
\chapter{
whatever
}

or moreprecisely the following. I really would appreciate some good
pointer so documentation or some sample files. (I know almost nothing
about SGML/XML/XSL/TEI, but I seem to make progress.)
--------------------------------
<!DOCTYPE TEI.2 PUBLIC "-//TEI P3//DTD Main Document Type//EN" 
  "tei2.dtd" [<!ENTITY % TEI.dictionaries 'INCLUDE'>]>
<tei.2>
<text>
<body>
<entry>
  <form>
     <orth>agosto</orth>
     <gen>m</gen>
  </form>
  <trans>
    <tr>August</tr>
    <gen>m</gen>
  </trans>
</entry>

</body>
</text>
</tei.2>
--------------------------------
becomes this:
--------------------------------
<?xml version="1.0" encoding="utf-8"?>

    \starttext

       \blanko{}
  {\bf 
     agosto
     {\it m}
  }
  {
    {August}
    {\it m}
  }

    \stoptext
-----------------------------
using this:
-----------------------------
<?xml version="1.0"?> 

<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="tei.2">
    \starttext
       <xsl:apply-templates/>
    \stoptext
</xsl:template>

<xsl:template match="teiheader">
    \startcomments
       <xsl:apply-templates/>
    \stopcomments
</xsl:template>

<xsl:template match="text">
       <xsl:apply-templates/>
</xsl:template>

<xsl:template match="body">
       <xsl:apply-templates/>
</xsl:template>

<xsl:template match="entry">
       \blanko{}<xsl:apply-templates/></xsl:template>

<xsl:template match="form">{\bf <xsl:apply-templates/>}</xsl:template>

<xsl:template match="gen">{\it <xsl:apply-templates/>}</xsl:template>

<xsl:template match="trans">{<xsl:apply-templates/>}</xsl:template>

<xsl:template match="tr">{<xsl:apply-templates/>}</xsl:template>

</xsl:transform>
-----------------------------------------

Tobias


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ConTeXt + TEI (an SGML derivate)
  2000-04-27 18:34       ` Tobias Burnus
@ 2000-04-27 19:57         ` Johannes Hüsing
  2000-04-27 21:34           ` Hans Hagen
  2000-04-27 21:25         ` Hans Hagen
  1 sibling, 1 reply; 10+ messages in thread
From: Johannes Hüsing @ 2000-04-27 19:57 UTC (permalink / raw)


On Thu 2000-04-27 (20:34), Tobias Burnus wrote:
> Hallo Hans, hallo Johannes, hi all,

Hallo Tobias,
> 
> > > One way of doing it is to use a simple xslt style sheet that maps elements
> > > onto context commands. In most cases one can ignore attributes, since they
> > > are handled at the style level. Things like:
> > > <chapter>whatever</chapter>
> > >
> > > are mapped by
> > >
> > > <xsl:template match="chapter">
> > > \chapter{<xsl:apply-templates/>}
> > > </xsl:template>
> > > \chapter{whatever}
> This doesn't seem to work here using TEI (SGML, tei.dtd) and with Java
> XT (PR-xslt-19991008) and a selfwritten incomplete stylesheet (XSL).
> 
> I get something like
> \chapter{
> whatever
> }

Is this parsed any differently by ConTeXt than \chapter{whatever} or are
you concerned about a messy looking ConTeXt file?

Disclaimer: I know almost nothing about the SGML/XML complex. I am interested
theoretically, hence my first reply may have sounded more knowledgable than
I actually am. 

I am quite disappointed with the fact that the Linuxdoc project is discontinued
and that the javatex package is not lavishly documented (by what I have
found so far), so if ConTeXt gained ground in this territory this would 
sound like a killer app to me.

Back to your problem: If the Java tool causes unwanted linefeeds, an 
obvious workaraound would be inserting

An obvious workaround would be to set up style annotations like:

<xsl:template match="chapter">
\chapter{%delete trailing linefeed<xsl:apply-templates/>%delete preceding linefeed}
</xsl:template>
and run the result through a filter which clears these comments along with 
the linefeeds.

Groetjes

Johannes


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ConTeXt + TEI (an SGML derivate)
  2000-04-27 18:34       ` Tobias Burnus
  2000-04-27 19:57         ` Johannes Hüsing
@ 2000-04-27 21:25         ` Hans Hagen
  2000-04-28 12:41           ` Ed L Cashin
  1 sibling, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2000-04-27 21:25 UTC (permalink / raw)
  Cc: NTG-ConTeXt

[how many users are interested in this; if needed we can set up a new list
for this, something ntg-xmlcont or so]

Hi Tobias, 

>I get something like
>\chapter{
>whatever
>}

Yes, xsl forces you to write ugly code to get rid of the spaces. Simply
don't use newlines in the xsl stylesheet. 

>or moreprecisely the following. I really would appreciate some good
>pointer so documentation or some sample files. (I know almost 

xml companion, bradley, aw, latest edition is ok, just bought it

Hans

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.nl
-----------------------------------------------------------------


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ConTeXt + TEI (an SGML derivate)
  2000-04-27 14:47     ` Johannes Hüsing
  2000-04-27 18:34       ` Tobias Burnus
@ 2000-04-27 21:28       ` Hans Hagen
  1 sibling, 0 replies; 10+ messages in thread
From: Hans Hagen @ 2000-04-27 21:28 UTC (permalink / raw)
  Cc: NTG-ConTeXt

At 04:47 PM 4/27/2000 +0200, Johannes Hüsing wrote:

>would you care to share the fruits of your experiments with us?

I expect to implement quite some stuff -) For instance I'm now testing html
based table stuff and so, new module btw.

Hans  

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.nl
-----------------------------------------------------------------


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ConTeXt + TEI (an SGML derivate)
  2000-04-27 19:57         ` Johannes Hüsing
@ 2000-04-27 21:34           ` Hans Hagen
  0 siblings, 0 replies; 10+ messages in thread
From: Hans Hagen @ 2000-04-27 21:34 UTC (permalink / raw)
  Cc: NTG-ConTeXt

Hi, 

>theoretically, hence my first reply may have sounded more knowledgable than
>I actually am. 

Well, I think a pretty large group of sgml/xml peopel claim this obscure
knowlegde. I'm sure taco can confirm this -)  

>I am quite disappointed with the fact that the Linuxdoc project is
discontinued
>and that the javatex package is not lavishly documented (by what I have
>found so far), so if ConTeXt gained ground in this territory this would 
>sound like a killer app to me.

With crossed fingers, but looking at what we're doing right now, I bet it
will gain ground in this territory -)  

The main focus in xml/xsl is in transforming xml into html. Since context
has a lot of built in stuff, we can stick to simple transformations, and
even xsl may be too overloaded (loading the whole tree for instance is not
really needed).  

Actually, it's xslt we're dealing with. 

What is needed, is simple mapping to high level context macros, that then
are set up in normal tex styles. 

><xsl:template match="chapter">
>\chapter{%delete trailing linefeed<xsl:apply-templates/>%delete preceding
linefeed}
></xsl:template>
>and run the result through a filter which clears these comments along with 
>the linefeeds.

Sounds indeed like a nice solution. 

Hans

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.nl
-----------------------------------------------------------------


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ConTeXt + TEI (an SGML derivate)
  2000-04-27 21:25         ` Hans Hagen
@ 2000-04-28 12:41           ` Ed L Cashin
  0 siblings, 0 replies; 10+ messages in thread
From: Ed L Cashin @ 2000-04-28 12:41 UTC (permalink / raw)
  Cc: Tobias Burnus, NTG-ConTeXt

Hans Hagen <pragma@wxs.nl> writes:

> [how many users are interested in this; if needed we can set up a new list
> for this, something ntg-xmlcont or so]

Personally, I think the list is very low-noise anyway, so I don't mind
extra messages.

... And it's interesting!

-- 
--Ed Cashin                     PGP public key:
  ecashin@coe.uga.edu           http://www.coe.uga.edu/~ecashin/pgp/


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2000-04-28 12:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-24 14:00 ConTeXt + TEI (an SGML derivate) Tobias Burnus
2000-04-25 14:09 ` Johannes Hüsing
2000-04-27  9:29   ` Hans Hagen
2000-04-27 14:47     ` Johannes Hüsing
2000-04-27 18:34       ` Tobias Burnus
2000-04-27 19:57         ` Johannes Hüsing
2000-04-27 21:34           ` Hans Hagen
2000-04-27 21:25         ` Hans Hagen
2000-04-28 12:41           ` Ed L Cashin
2000-04-27 21:28       ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).