ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* XML & <formula>s
@ 2004-12-09 21:10 Adam Lindsay
  2004-12-10 21:38 ` h h extern
  0 siblings, 1 reply; 9+ messages in thread
From: Adam Lindsay @ 2004-12-09 21:10 UTC (permalink / raw)


Hi all.

I want to use XML, but in a non-doctrinaire way: I much prefer TeX
formula writing to mathml by hand. 

I looked at xtag-mml, and the \defineXMLenvironment [formula] looked like
just what I wanted. However, when trying it, the XML catcode regime was
still in effect, and the backslashes were printed, and didn't act as escapes.

Am I missing something in the correct usage, or is support "incomplete"?


This is a sample file, showing how I've been trying to use it:

\useXMLfilter[mml]
\starttext
\startXMLdata
<formula>
t+3+x+t\neq m\alpha\frac\theta\hbar
</formula>
\stopXMLdata
\stoptext


Also, what's the status of contml? I like the idea of it as a simple,
structural, basic markup that ConTeXt handles with zero effort, but is
anyone actually using it?

adam
-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Adam T. Lindsay, Computing Dept.     atl@comp.lancs.ac.uk
 Lancaster University, InfoLab21        +44(0)1524/510.514
 Lancaster, LA1 4WA, UK             Fax:+44(0)1524/510.492
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

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

* Re: XML & <formula>s
  2004-12-09 21:10 XML & <formula>s Adam Lindsay
@ 2004-12-10 21:38 ` h h extern
  2004-12-10 23:02   ` Adam Lindsay
  2004-12-13 18:02   ` mag-0008 (was: XML & <formula>s) Adam Lindsay
  0 siblings, 2 replies; 9+ messages in thread
From: h h extern @ 2004-12-10 21:38 UTC (permalink / raw)


Adam Lindsay wrote:
> Hi all.
> 
> I want to use XML, but in a non-doctrinaire way: I much prefer TeX
> formula writing to mathml by hand. 
> 
> I looked at xtag-mml, and the \defineXMLenvironment [formula] looked like
> just what I wanted. However, when trying it, the XML catcode regime was
> still in effect, and the backslashes were printed, and didn't act as escapes.
> 
> Am I missing something in the correct usage, or is support "incomplete"?
> 
> 
> This is a sample file, showing how I've been trying to use it:
> 
> \useXMLfilter[mml]
> \starttext
> \startXMLdata
> <formula>
> t+3+x+t\neq m\alpha\frac\theta\hbar
> </formula>
> \stopXMLdata
> \stoptext

\starttext

\unprotected \def\XMLtex#1%
   {\begingroup
    \disableXML
    \scantokens\@EA\@EA\@EA{\csname\@@XMLdata:#1\endcsname}%
    \endgroup}

\defineXMLenvironmentsave
   [formula]
   {}
   {\XMLtex{formula}}

\input bryson

\startXMLdata
<formula>
t+3+x+t\neq m\alpha\frac\theta\hbar
</formula>
\stopXMLdata

\input thuan

\stoptext

> Also, what's the status of contml? I like the idea of it as a simple,
> structural, basic markup that ConTeXt handles with zero effort, but is
> anyone actually using it?

we sometimes mix it into other xml docs; i have no problem with extending it; 
actualy, (see mag-0008.pdf), i want to map most context directly onto xml so 
that we have a rather complete xml input syntax

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.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------

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

* Re: XML & <formula>s
  2004-12-10 21:38 ` h h extern
@ 2004-12-10 23:02   ` Adam Lindsay
  2004-12-12 21:34     ` h h extern
  2004-12-13 18:02   ` mag-0008 (was: XML & <formula>s) Adam Lindsay
  1 sibling, 1 reply; 9+ messages in thread
From: Adam Lindsay @ 2004-12-10 23:02 UTC (permalink / raw)


h h extern said this at Fri, 10 Dec 2004 22:38:27 +0100:

>\unprotected \def\XMLtex#1%
>   {\begingroup
>    \disableXML
>    \scantokens\@EA\@EA\@EA{\csname\@@XMLdata:#1\endcsname}%
>    \endgroup}

Okay. More strange and wondrous magic. Thanks!
I notice there's a \let\XMLtex already in xtag-ini...

>\defineXMLenvironmentsave
>   [formula]
>   {}
>   {\XMLtex{formula}}

Hmm. No math there on my machine.
So do you reckon that this is an acceptable elaboration?

\defineXMLenvironmentsave
   [formula] [label=]
   {}
   {\startformula[\XMLop{label}]
     \XMLtex{formula} \stopformula}

(it runs okay on limited variations here)

Is the existing [formula] definition in xtag-mml obsolete, then?

>> Also, what's the status of contml? I like the idea of it as a simple,
>> structural, basic markup that ConTeXt handles with zero effort, but is
>> anyone actually using it?
>
>we sometimes mix it into other xml docs; i have no problem with
extending it; 
>actualy, (see mag-0008.pdf), i want to map most context directly onto xml so 
>that we have a rather complete xml input syntax

Okay, cool. I may have found my general authoring tool once I get this
transform worted...
-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Adam T. Lindsay, Computing Dept.     atl@comp.lancs.ac.uk
 Lancaster University, InfoLab21        +44(0)1524/510.514
 Lancaster, LA1 4WA, UK             Fax:+44(0)1524/510.492
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

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

* Re: XML & <formula>s
  2004-12-10 23:02   ` Adam Lindsay
@ 2004-12-12 21:34     ` h h extern
  0 siblings, 0 replies; 9+ messages in thread
From: h h extern @ 2004-12-12 21:34 UTC (permalink / raw)


Adam Lindsay wrote:
> So do you reckon that this is an acceptable elaboration?
> 
> \defineXMLenvironmentsave
>    [formula] [label=]
>    {}
>    {\startformula[\XMLop{label}]
>      \XMLtex{formula} \stopformula}
> 
> (it runs okay on limited variations here)

should be ok

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.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------

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

* mag-0008 (was: XML & <formula>s)
  2004-12-10 21:38 ` h h extern
  2004-12-10 23:02   ` Adam Lindsay
@ 2004-12-13 18:02   ` Adam Lindsay
  2004-12-13 21:23     ` Bruce D'Arcus
  2004-12-15 17:14     ` mag-0008 Hans Hagen
  1 sibling, 2 replies; 9+ messages in thread
From: Adam Lindsay @ 2004-12-13 18:02 UTC (permalink / raw)


h h extern said this at Fri, 10 Dec 2004 22:38:27 +0100:

>> Also, what's the status of contml? I like the idea of it as a simple,
>> structural, basic markup that ConTeXt handles with zero effort, but is
>> anyone actually using it?
>
>we sometimes mix it into other xml docs; i have no problem with
extending it; 
>actualy, (see mag-0008.pdf), i want to map most context directly onto xml so 
>that we have a rather complete xml input syntax

Yes, indeed. I took a look at the magazine again last night, and it was
put in an entirely new light. I'm very curious to work with x-fx now...

I've been working on a general-ish conversion script from a new Mac
application. I'd like to offer most of ContML as basic level constructs,
but it should be possible for a user to add their own tags. If they can
tap into fx:anything tags, it should make people (hi, Bruce!) fairly happy.

My first reaction/critique of the approach was: why not fix at least one
of the problems of TeX: that it's "a mixture between typesetting and
programming features" as you say? 

What I propose is clearly a debatable XML-design issue, but it seemed
strange that fx:definelayout and fx:p were put into the same namespace.
Why do the formatting definitions share the same (theoretical) schema as
markup? Your documents keep these categories separate, as one would
expect. Why not encourage people to put them in separate files, as with
"normal" ConTeXt workflows? The designer and author are more clearly
divorced when you don't assume an XSLT-centric flow, right?
(or, is this already planned with this tidbit from foxet: fs = setup)

I'm curious about how the namespacing would work, though, because I want
to use (and enable the use of) these nice fs:setuphead -like
configurations with my hybrid ContML++ documents. Will:
 <fs:setuphead label='section' />
correctly (in my mind) affect a ContML element like this?
 <context:section>something</context:section>

Curious,
adam
-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Adam T. Lindsay, Computing Dept.     atl@comp.lancs.ac.uk
 Lancaster University, InfoLab21        +44(0)1524/510.514
 Lancaster, LA1 4WA, UK             Fax:+44(0)1524/510.492
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

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

* Re: mag-0008 (was: XML & <formula>s)
  2004-12-13 18:02   ` mag-0008 (was: XML & <formula>s) Adam Lindsay
@ 2004-12-13 21:23     ` Bruce D'Arcus
  2004-12-15 17:16       ` mag-0008 Hans Hagen
  2004-12-15 17:14     ` mag-0008 Hans Hagen
  1 sibling, 1 reply; 9+ messages in thread
From: Bruce D'Arcus @ 2004-12-13 21:23 UTC (permalink / raw)
  Cc: mailing list for ConTeXt users, Hans Hagen


On Dec 13, 2004, at 1:02 PM, Adam Lindsay wrote:

> What I propose is clearly a debatable XML-design issue, but it seemed
> strange that fx:definelayout and fx:p were put into the same namespace.
> Why do the formatting definitions share the same (theoretical) schema 
> as
> markup? Your documents keep these categories separate, as one would
> expect. Why not encourage people to put them in separate files, as with
> "normal" ConTeXt workflows? The designer and author are more clearly
> divorced when you don't assume an XSLT-centric flow, right?

FWIW, I'm currently working on a comprehensive XSLT-based solution for 
bibliographic formatting (think bibtex for xml, only better).  In that, 
I'm working across multiple namespaces:

1)  document (docbook ng)
2)  bibliographic data (mods)
3)  a citation formatting language (homegrown; again, in its own 
namespace)
4)  output (xhtml, for example)

I agree with the notion that, in principle, semantic document markup 
should be in a separate namespace from the formatting language.

BTW, Hans, I've yet to see the ContML schema.  Care to post it 
somewhere?

Also, FYI, I and an engineer at Sun have some up with a small citation 
schema designed for embedding in other XML dialects.  It has been 
approved for OpenOffice.

	http://www.users.muohio.edu/darcusb/files/citation-schema.tar.gz

It's more for GUI apps (it's rather verbose), but could still be useful 
in other contexts.

Bruce

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

* Re: mag-0008
  2004-12-13 18:02   ` mag-0008 (was: XML & <formula>s) Adam Lindsay
  2004-12-13 21:23     ` Bruce D'Arcus
@ 2004-12-15 17:14     ` Hans Hagen
  1 sibling, 0 replies; 9+ messages in thread
From: Hans Hagen @ 2004-12-15 17:14 UTC (permalink / raw)
  Cc: mailing list for ConTeXt users, Bruce D'Arcus

Adam Lindsay wrote:
> h h extern said this at Fri, 10 Dec 2004 22:38:27 +0100:
> 
> 
>>>Also, what's the status of contml? I like the idea of it as a simple,
>>>structural, basic markup that ConTeXt handles with zero effort, but is
>>>anyone actually using it?
>>
>>we sometimes mix it into other xml docs; i have no problem with
> 
> extending it; 
> 
>>actualy, (see mag-0008.pdf), i want to map most context directly onto xml so 
>>that we have a rather complete xml input syntax
> 
> 
> Yes, indeed. I took a look at the magazine again last night, and it was
> put in an entirely new light. I'm very curious to work with x-fx now...

see below

> I've been working on a general-ish conversion script from a new Mac
> application. I'd like to offer most of ContML as basic level constructs,
> but it should be possible for a user to add their own tags. If they can
> tap into fx:anything tags, it should make people (hi, Bruce!) fairly happy.
> 
> My first reaction/critique of the approach was: why not fix at least one
> of the problems of TeX: that it's "a mixture between typesetting and
> programming features" as you say? 

indeed, but, it al depends on the 'to be written' manuals then:

- code in xml and then
- use xslt to generate an (structured) instance that
- calls templates that implement typographical solutions
- using the xml interface to context

in practice it means trading in some context funtionality by xslt functionality

the interesting thing is that the whole machinery is still there

> What I propose is clearly a debatable XML-design issue, but it seemed
> strange that fx:definelayout and fx:p were put into the same namespace.
> Why do the formatting definitions share the same (theoretical) schema as
> markup? Your documents keep these categories separate, as one would
> expect. Why not encourage people to put them in separate files, as with
> "normal" ConTeXt workflows? The designer and author are more clearly
> divorced when you don't assume an XSLT-centric flow, right?
> (or, is this already planned with this tidbit from foxet: fs = setup)

sure, definitions should become 'styles' but that's hard to demo in a magazine -)

in principle it could also mean that one could predefine page masters and have 
multiple variants instead of the five-area-fo-thing

> I'm curious about how the namespacing would work, though, because I want
> to use (and enable the use of) these nice fs:setuphead -like
> configurations with my hybrid ContML++ documents. Will:

context\high{fx}

>  <fs:setuphead label='section' />
> correctly (in my mind) affect a ContML element like this?
>  <context:section>something</context:section>

indeed, or

<context:head label='section'>something</context:head>

a matter of taste; i'm open to any suggestion (more a discussion for the foxet 
list)

> Curious,

well, here 's an <experimental/> version of x-fx. It demonstrates that it's 
relaively easy to map the context interface to xml; actually, if things get 
dirty i can provide a more low level context support which then makes the 
mapping clean -)

%D \module
%D   [      file=x-fx,
%D        version=2004.11.12,
%D          title=\FOXET,
%D       subtitle=Style Processor,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\chardef\XMLtokensreduction = 2
\chardef\XMLcdatamethod     = 2

\usemodule[mathml]

\setupcolors[state=start]

% these will be speed up by few step expansion

\def\foxarguments {\theXMLarguments{fox}}
\def\initializefox{\expanded{\getrawparameters[fox][\theXMLarguments{fox}]}}
\def\foxaction  #1{\expanded{#1[\theXMLarguments{fox}]}}

% layers

\defineXMLcommand
   [fx:definelayer] [fox] [label=default]
   {\initializefox
    \expanded{\definelayer[\foxlabel]}%
    \expanded{\setuplayer[\foxlabel][\foxarguments]}}

\defineXMLcommand
   [fx:setuplayer] [fox] [label=default]
   {\initializefox
    \expanded{\setuplayer[\foxlabel][\foxarguments]}}

\defineXMLenvironment
   [fx:setlayer] [fox] [label=default]
   {\initializefox
    \expanded{\setlayer[\foxlabel][\foxarguments]}\bgroup\ignorespaces}
   {\removeunwantedspaces\egroup}

\defineXMLcommand
   [fx:flushlayer] [fox] [label=default]
   {\initializefox
    \tightlayer[\foxlabel]}

% framed

\defineXMLenvironment
   [fx:framed] [fox] []
   {\initializefox
    \expanded{\framed[\foxarguments]}\bgroup\ignorespaces}
   {\removeunwantedspaces\egroup}

% layout

\defineXMLcommand
   [fx:definelayout] [fox] [label=default]
   {\initializefox
    \expanded{\definelayout[\foxlabel][\foxarguments]}}

\defineXMLcommand
   [fx:setuplayout] [fox] [label=default]
   {\initializefox
    \expanded{\setuplayout[\foxlabel][\foxarguments]}
    }% \expanded{\setuplayout[\foxlabel]}} % todo: only when no further arguments

\defineXMLcommand
   [fx:enablelayout] [fox] [label=default]
   {\initializefox
    \expanded{\setuplayout[\foxlabel]}}

% heads / we need a stupid, not list/ref variant

\defineXMLcommand
   [fx:definehead] [fox] [label=default,level=1]
   {\initializefox
 
\expanded{\definehead[fx:head:\foxlabel][section=section-\foxlevel,incrementnumber=no]}%
    \expanded{\setuphead[fx:head:\foxlabel][\foxarguments,alternative=command]}}

\defineXMLcommand
   [fx:setuphead] [fox] [label=default]
   {\initializefox
    \expanded{\setuphead[fx:head:\foxlabel][\foxarguments,alternative=command]}}

\defineXMLenvironmentsave
   [fx:head] [fox] [label=default]
   {\bgroup}
   {\initializefox
    \expanded{\setuphead[fx:head:\foxlabel][\foxarguments,alternative=command]}%
    \getvalue{fx:head:\foxlabel}{\vbox{\forgetall\XMLflush{fx:head}}}%
    \egroup}

% page

\defineXMLcommand
   [fx:page] [fox] [command=yes]
   {\initializefox
    \expanded{\page[\foxcommand]}}

% tabulate / todo: in context preamble also definable this way, then direct map

\setuptabulate[before=,after=]

\startsetups fox:tabulate

     \defineXMLenvironment
         [fx:preamble]
         {\scratchtoks\emptytoks}
         {\appendetoks|\to\scratchtoks}

     \defineXMLpickup
         [fx:tbody]
         {\expanded{\starttabulate[\the\scratchtoks]}}
         {\stoptabulate}

     \defineXMLcommand
         [fx:e] [fox] [width=,align=,type=line,style=] % line|paragraph
         {\initializefox
          \appendetoks|\to\scratchtoks
          \doifelse{\foxtype}{paragraph}{\appendetoks 
p\to\scratchtoks}{\appendetoks w\to\scratchtoks}%
          \doifsomething{\foxwidth}{\appendetoks(\foxwidth)\to\scratchtoks}%
          \appendetoks\XMLval{fox:tab:style}{\foxstyle}{}\to\scratchtoks
          \appendetoks\XMLval{fox:tab:align}{\foxalign}{}\to\scratchtoks}

     \defineXMLenvironment [fx:r]  {}    {\NC \NR}
     \defineXMLenvironment [fx:c]  {\NC} {}
     \defineXMLenvironment [fx:tr] {}    {\NC \NR}
     \defineXMLenvironment [fx:td] {\NC} {}

\stopsetups

\mapXMLvalue {fox:tab:align} {flushleft}  {l}
\mapXMLvalue {fox:tab:align} {flushright} {r}
\mapXMLvalue {fox:tab:align} {center}     {c}

\mapXMLvalue {fox:tab:style} {italic}     {I}
\mapXMLvalue {fox:tab:style} {bold}       {B}
\mapXMLvalue {fox:tab:style} {slanted}    {S}

\defineXMLenvironment
   [fx:tabulate] [fox] []
   {}
   {}

\defineXMLenvironment
   [fx:tabulate] [fox] []
   {\bgroup
    \directsetup{fox:tabulate}}
   {\egroup}

% itemize

\defineXMLcommand
   [fx:defineitemize] [fox] [label=default] % maybe also \defineitemgroup as synonym
   {\initializefox
    \expanded{\defineitemgroup[\foxlabel]}%
    \expanded{\setupitemgroup[\foxlabel][\foxarguments]}}

\defineXMLcommand
   [fx:setupitemize] [fox] [label=default]
   {\initializefox
    \expanded{\setupitemgroup[\foxlabel][\foxarguments]}}

\defineXMLenvironment
   [fx:itemize] [fox] [label=default]
   {\initializefox
    \expanded{\startitemgroup[\foxlabel]}\ignorespaces}
   {\stopitemgroup}

\defineXMLenvironment
   [fx:item] [fox] [type=normal,symbol=]
   {\initializefox
    \XMLval{fox:item:type}{\foxtype}{normal}}
   {\par}

\mapXMLvalue {fox:item:type} {normal} {\item}
\mapXMLvalue {fox:item:type} {margin} {\mar{\foxsymbol}}
\mapXMLvalue {fox:item:type} {symbol} {\sym{\foxsymbol}}

% table

% first last odd even row column header each <n> <m>

\startsetups fox:table

     \defineXMLprocess
         [fx:preamble]

     \defineXMLcommand [fx:c] [fox] [r=each]
         {\initializefox\expanded{\setupTABLE[r][\foxr][\foxarguments]}}

     \defineXMLcommand
         [fx:r] [fox] [c=each]
         {\initializefox\expanded{\setupTABLE[c][\foxc][\foxarguments]}}

     \defineXMLcommand
         [fx:h] [fox] [c=each]
         {\initializefox\expanded{\setupTABLE[header][\foxc][\foxarguments]}}

     \defineXMLcommand
         [fx:e] [fox] [type=,c=each,r=each]
         {\initializefox
          \doifelse{\foxtype}{row}
            {\expanded{\setupTABLE[r][\foxr][\foxarguments]}}
            {\doifelse{\foxtype}{column}
               {\expanded{\setupTABLE[c][\foxc][\foxarguments]}}
               {\expanded{\setupTABLE[\foxc][\foxr][\foxarguments]}}}}

     \defineXMLnested [fx:thead] [fox] [] 
{\expanded{\bTABLEhead[\foxarguments]}} {\eTABLEhead}
     \defineXMLnested [fx:tfoot] [fox] [] 
{\expanded{\bTABLEfoot[\foxarguments]}} {\eTABLEfoot}
     \defineXMLnested [fx:tnext] [fox] [] 
{\expanded{\bTABLEnext[\foxarguments]}} {\eTABLEnext}
     \defineXMLnested [fx:tbody] [fox] [] 
{\expanded{\bTABLEbody[\foxarguments]}} {\eTABLEbody}
     \defineXMLnested [fx:tr]    [fox] [] {\expanded{\bTR[\foxarguments]}} 
   {\eTR}
     \defineXMLnested [fx:td]    [fox] [] {\expanded{\bTD[\foxarguments]}} 
   {\eTD}

\stopsetups

\defineXMLnested
   [fx:table] [fox] []
   {\bgroup
    \directsetup{fox:table}
    \expanded{\bTABLE[\foxarguments]}}
   {\eTABLE
    \egroup}

% misc

\defineXMLenvironment
   [fx:narrower] [fox] [left=0em,right=0em]
   {\expanded{\setupnarrower[\foxarguments]}%
    \startnarrower[middle]}
   {\stopnarrower}

\defineXMLenvironment
   [fx:text] [fox] []
   {\starttext}
   {\stoptext}

% paragraphs

\newcount \paragraphdepth

\defineXMLenvironment
     [fx:p] [fox] [strut=no]
     {\advance\paragraphdepth\plusone
      \initializefox
      \doifelse{\foxstrut}{yes}
        {\setvalue{fx:p:strut:\the\paragraphdepth}{1}}
        {\setvalue{fx:p:strut:\the\paragraphdepth}{0}}%
      \ifcase\getvalue{fx:p:strut:\the\paragraphdepth}\or\begstrut\fi}
     {\ifcase\getvalue{fx:p:strut:\the\paragraphdepth}\or\endstrut\fi
      \endgraf
      \advance\paragraphdepth\minusone}

% fonts

\def\startfont[#1]{\bgroup\getvalue{#1}}
\def\stopfont     {\egroup}

\defineXMLcommand
   [fx:definefont] [fox]
   [label=fallbackfont,spec=lmtt10] % todo: more efficient (no spec/label in 
third arg)
   {\initializefox
    \expanded{\definefont[fx:font:\foxlabel][\foxspec][spec=,label=,\foxarguments]}}

\defineXMLnested
   [fx:font] [fox]
   [label=fallbackfont]
   {\initializefox
    \startfont[fx:font:\foxlabel]}
   {\stopfont}

% color

\defineXMLcommand
   [fx:definecolor] [fox]
   [label=fallbackcolor]
   {\initializefox
    \expanded{\definecolor[fx:color:\foxlabel][\foxarguments]}}

\defineXMLnested
   [fx:color] [fox]
   [label=fallbackfont]
   {\initializefox
    \startcolor[fx:color:\foxlabel]}
   {\stopcolor}

% margin things

\setupinmargin[style=,color=]

\defineXMLargument
   [fx:margintext] [fox] [label=default]
   {\margintext}

% so far

\doifnotmode{demo}{\endinput}

% test

\startbuffer[demo]
<fx:definelayout label='main' backspace='2cm' cutspace='2cm' topspace='2cm' 
bottomspace='2cm'/>

<fx:enablelayout label='main'/>

<fx:defineitemize label='mine'/>

<!-- test layer -->

<fx:definelayer label='test'/>

<fx:setuplayer label='test' width='10cm' height='10cm'/>

<fx:setlayer label='test' preset='lefttop'>
     <fx:framed width='4cm' height='5cm'>
         Left Top
     </fx:framed>
</fx:setlayer>

<fx:setlayer label='test' preset='rightbottom'>
     <fx:framed width='3cm' height='4cm'>
         Right Bottom
     </fx:framed>
</fx:setlayer>

<fx:flushlayer label='test'/>

<fx:narrower>
A bit of text!
     <fx:narrower left='1em'>
     A bit of text!
         <fx:narrower left='3em'>
             A bit of text!
             <fx:narrower right='1em'>
                 A bit of text!
             </fx:narrower>
         </fx:narrower>
     </fx:narrower>
</fx:narrower>

<!-- chapter head -->

<fx:definehead label='chapter'/>

<fx:definelayer label='chapter' width='10cm' method='fit'/>

<fx:page command='yes'/>

<fx:head label='chapter'>
     <fx:setlayer label='chapter' preset='lefttop' hoffset='0cm'>
         <fx:framed>12</fx:framed>
     </fx:setlayer>
     <fx:setlayer label='chapter' preset='lefttop' hoffset='2cm'>
         <fx:framed>The Title</fx:framed>
     </fx:setlayer>
     <fx:flushlayer label='chapter'/>
</fx:head>

<p>Some text!</p>

<fx:tabulate>
     <fx:preamble>
         <fx:e width='1cm' align='flushleft'/>
         <fx:e width='2cm' align='flushright'/>
         <fx:e width='3cm' align='center'/>
         <fx:e width='4cm'/>
     </fx:preamble>
     <fx:body>
         <fx:tr><fx:td>test   1</fx:td><fx:td>test   2</fx:td><fx:td>test 
3</fx:td><fx:td>test   4</fx:td></fx:tr>
         <fx:tr><fx:td>test  11</fx:td><fx:td>test  22</fx:td><fx:td>test 
33</fx:td><fx:td>test  44</fx:td></fx:tr>
         <fx:tr><fx:td>test 111</fx:td><fx:td>test 222</fx:td><fx:td>test 
333</fx:td><fx:td>test 444</fx:td></fx:tr>
     </fx:body>
</fx:tabulate>

<fx:tabulate>
     <fx:preamble>
         <fx:e style='bold'/>
         <fx:e type='paragraph' style='normal'/>
         <fx:e style='italic'/>
         <fx:e type='paragraph' style='slanted'/>
     </fx:preamble>
     <fx:tbody>
         <fx:tr><fx:td>test   1</fx:td><fx:td>test   2</fx:td><fx:td>test 
3</fx:td><fx:td>test   4</fx:td></fx:tr>
         <fx:tr><fx:td>test  11</fx:td><fx:td>test  22</fx:td><fx:td>test 
33</fx:td><fx:td>test  44</fx:td></fx:tr>
         <fx:tr><fx:td>test 111</fx:td><fx:td>test 222</fx:td><fx:td>test 
333</fx:td><fx:td>test 444</fx:td></fx:tr>
     </fx:body>
</fx:tabulate>

<fx:itemize>
     <fx:item>first</fx:item>
     <fx:itemize>
         <fx:item>first</fx:item>
         <fx:item type='symbol' symbol='+'>second</fx:item>
         <fx:item>third</fx:item>
     </fx:itemize>
     <fx:item type='margin' symbol='+'>second</fx:item>
     <fx:item>third</fx:item>
</fx:itemize>

<fx:table>
     <fx:preamble>
         <fx:r           c='2' background='color' backgroundcolor='red'   />
         <fx:h           c='3' background='color' backgroundcolor='yellow'/>
         <fx:c r='odd'         background='color' backgroundcolor='green' />
         <fx:c r='last'        background='color' backgroundcolor='green' />
         <fx:e r='3'     c='2' background='color' backgroundcolor='blue'  />
     </fx:preamble>
     <fx:thead>
         <fx:tr> <fx:td>a</fx:td> <fx:td>b</fx:td> <fx:td>c</fx:td> </fx:tr>
         <fx:tr> <fx:td>a</fx:td> <fx:td>b</fx:td> <fx:td>c</fx:td> </fx:tr>
     </fx:thead>
     <fx:tbody>
         <fx:tr> <fx:td>a</fx:td> <fx:td>b</fx:td> <fx:td>c</fx:td> </fx:tr>
         <fx:tr> <fx:td>a</fx:td> <fx:td>b</fx:td> <fx:td>c</fx:td> </fx:tr>
         <fx:tr> <fx:td>a</fx:td> <fx:td>b</fx:td> <fx:td>c</fx:td> </fx:tr>
         <fx:tr> <fx:td>a</fx:td> <fx:td>b</fx:td> <fx:td>c</fx:td> </fx:tr>
         <fx:tr> <fx:td>a</fx:td> <fx:td>b</fx:td> <fx:td>c</fx:td> </fx:tr>
     </fx:tbody>
</fx:table>
\stopbuffer

\starttext

\showframe

\typebuffer[demo]

\processXMLbuffer[demo]

\relax

\stoptext



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

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

* Re: mag-0008
  2004-12-13 21:23     ` Bruce D'Arcus
@ 2004-12-15 17:16       ` Hans Hagen
  2004-12-15 17:53         ` mag-0008 Bruce D'Arcus
  0 siblings, 1 reply; 9+ messages in thread
From: Hans Hagen @ 2004-12-15 17:16 UTC (permalink / raw)


Bruce D'Arcus wrote:

> BTW, Hans, I've yet to see the ContML schema.  Care to post it somewhere?

that was from the time that i played with schema's, nowadays i prefer relax ng

the funny <?context-block ?> things can be used by some modules (in the 
distribution) to filter definitions for documentation purposes;

<?xml version="1.0"?>


<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">


<xsd:annotation>
   <xsd:documentation xml:lang="en">
     This schema describes a class of presentations. The structure is
     (normally) reflected in the design.

     author: Hans Hagen, copyright: PRAGMA-ADE / Hasselt NL
   </xsd:documentation>
</xsd:annotation>


<?context-block begin definitions ?>

   <xsd:complexType name="filename.value">
     <xsd:restriction base="xsd:string">
       <xsd:pattern value='[a-zA-Z0-9\-\:\.]*' />
     </xsd:restriction>
   </xsd:complexType>

   <xsd:complexType name="filetype.value">
     <xsd:restriction base="xsd:string">
       <xsd:enumeration value="tex" />
       <xsd:enumeration value="xml" />
       <xsd:enumeration value="txt" />
     </xsd:restriction>
   </xsd:complexType>

   <xsd:complexType name="confirmation.value">
     <xsd:restriction base="xsd:string">
       <xsd:enumeration value="yes" />
       <xsd:enumeration value="no" />
     </xsd:restriction>
   </xsd:complexType>

   <xsd:complexType name="conversion.value">
     <xsd:restriction base="xsd:string">
       <xsd:pattern value='(a|A|n|g|G|r|R|1|2|3|4)' />
     </xsd:restriction>
   </xsd:complexType>

   <xsd:complexType name="reference.label.value">
     <xsd:restriction base="xsd:string">
       <xsd:pattern value='([a-zA-Z0-9\-\:]*' />
     </xsd:restriction>
   </xsd:complexType>

<?context-block end definitions ?>


<?context-block begin text ?>

   <xsd:element name="presentation" mixed="true" />

<?context-block end text ?>


<?context-block begin p ?>

   <xsd:element name="p" mixed="true" />

<?context-block end p ?>


<?context-block begin hide ?>

   <xsd:element name="hide" mixed="true" />

<?context-block end hide ?>


<?context-block begin em ?>

   <xsd:element name="em" mixed="true" />

<?context-block end em ?>


<?context-block begin b ?>

   <xsd:element name="b" mixed="true" />

<?context-block end b ?>


<?context-block begin quote ?>

   <xsd:element name="quote" mixed="true" />
   <xsd:element name="quotation" mixed="true" />

<?context-block end quote ?>


<?context-block begin include ?>

   <xsd:attributeGroup name="include.attributes">
     <xsd:attribute name="file" type="filename.value" use="required" />
     <xsd:attribute name="type" type="filetype.value" />
   </xsd:attributeGroup>

   <xsd:complexType type="include.type">
     <xsd:attributeGroup ref="include.attributes" />
   </xsd:complexType>

   <xsd:element name="include" type="include.type" />

<?context-block end include ?>


<?context-block begin compound ?>

   <xsd:attributeGroup name="compound.attributes">
     <xsd:attribute name="token" type="xsd:string" />
   </xsd:attributeGroup>

   <xsd:complexType type="compound.type">
     <xsd:attributeGroup ref="compound.attributes" />
   </xsd:complexType>

   <xsd:element name="compound" type="compound.type" />

<?context-block end compound ?>


<?context-block begin references ?>

   <xsd:attributeGroup name="reference.attributes">
     <xsd:attribute name="label" type="reference.label.value" />
   </xsd:attributeGroup>

   <xsd:complexType type="reference.type">
     <xsd:attributeGroup ref="reference.attributes" />
   </xsd:complexType>

   <xsd:element name="lineref" type="reference.type" />
   <xsd:element name="pageref" type="reference.type" />
   <xsd:element name="textref" type="reference.type" />

<?context-block end references ?>


<?context-block begin unknown ?>

   <xsd:element name="unknown"/>

<?context-block end unknown ?>


<?context-block begin verbatim ?> <!-- string or anyType -->

   <xsd:complexType name="verbatim.verbatim">
     <xsd:sequence maxOccurs="unbounded" >
       <xsd:element name="line" type="xsd:string" />
     </xsd:sequence>
   </xsd:complexType>

   <xsd:element name="verbatim" type="verbatim.verbatim" />
   <xsd:element name="typing"   type="verbatim.verbatim" />

   <xsd:element name="verb" type="xsd:string" />
   <xsd:element name="type" type="xsd:string" />

<?context-block end verbatim ?>


<?context-block begin itemize ?>

   <xsd:attributeGroup name="itemize.attributes">
     <xsd:attribute name="type"   type="conversion.value" />
     <xsd:attribute name="packed" type="confirmation.value" />
     <xsd:attribute name="label"  type="reference.label.value" />
   </xsd:attributeGroup>

   <xsd:attributeGroup name="item.attributes">
     <xsd:attribute name="label" type="reference.label.value" />
   </xsd:attributeGroup>

   <xsd:complexType name="item.type" mixed="true">
     <xsd:attributeGroup ref="item.attributes" />
   </xsd:complexType>

   <xsd:complexType name="itemize.type">
     <xsd:sequence minOccurs="1" maxOccurs="unbounded">
       <xml:element name="item" type="item.type" />
     </xsd:sequence>
     <xsd:attributeGroup ref="itemize.attributes" />
   </xsd:complexType>

   <xsd:element name="itemize" type="itemize.type" />

<?context-block end itemize ?>


<?context-block begin fixed ?>

   <xsd:complexType name="fixed.type.value">
     <xsd:restriction base="xsd:string">
       <xsd:enumeration value="figure" />
       <xsd:enumeration value="table" />
     </xsd:restriction>
   </xsd:complexType>

   <xsd:complexType name="fixed.location.value">
     <xsd:restriction base="xsd:string">
       <xsd:enumeration value="high" />
       <xsd:enumeration value="low"  />
       <xsd:enumeration value="lohi" />
     </xsd:restriction>
   </xsd:complexType>

   <xsd:attributeGroup name="fixed.attributes">
     <xsd:attribute name="type"     type="fixed.type.value" />
     <xsd:attribute name="location" type="fixed.location.value" />
     <xsd:attribute name="label"    type="reference.label.value" />
   </xsd:attributeGroup>

   <xsd:complexType name="fixed.type">
     <xsd:all>
       <xsd:element name="caption" mixed="true" />
       <xsd:element name="content" mixed="true" />
     </xsd:all>
     <xsd:attributeGroup ref="fixed.attributes" />
   </xsd:complexType>

   <xsd:element name="fixed" type="fixed.type" />

<?context-block end fixed ?>


<?context-block begin float ?>

   <xsd:complexType name="float.type.value">
     <xsd:restriction base="xsd:string">
       <xsd:enumeration value="figure" />
       <xsd:enumeration value="table" />
     </xsd:restriction>
   </xsd:complexType>

   <xsd:complexType name="float.location.value">
     <xsd:restriction base="xsd:string">
       <xsd:enumeration value="high" />
       <xsd:enumeration value="low" />
       <xsd:enumeration value="lohi" />
     </xsd:restriction>
   </xsd:complexType>

   <xsd:attributeGroup name="float.attributes">
     <xsd:attribute name="type"     type="float.type.value" />
     <xsd:attribute name="location" type="float.location.value" />
     <xsd:attribute name="label"    type="reference.label.value" />
   </xsd:attributeGroup>

   <xsd:complexType name="float.type">
     <xsd:all>
       <xsd:element name="caption" mixed="true" />
       <xsd:element name="content" mixed="true" />
     </xsd:all>
     <xsd:attributeGroup ref="float.attributes" />
   </xsd:complexType>

   <xsd:element name="float" type="float.type" />

<?context-block end float ?>


<?context-block begin externalfigure ?>

   <xsd:attributeGroup name="externalfigure.attributes">
     <xsd:extension base="context.kernel.externalfigure.attributes">
       <xsd:attribute name="base"  type="filename.value"/>
       <xsd:attribute name="file"  type="filename.value"/>
       <xsd:attribute name="label" type="reference.label.value"/>
     </xsd:extension>
   </xsd:attributeGroup>

   <xsd:complexType name="externalfigure.type">
     <xsd:attributeGroup ref="externalfigure.attributes" />
   </xsd:complexType>

   <xsd:element name="externalfigure" type="externalfigure.type" />

<?context-block end externalfigure ?>


<?context-block begin table ?>

   <xsd:attributeGroup name="table.attributes">
     <!-- these elements inherit ConTeXt TABLE parameters -->
     <xsd:extension base="context.kernel.table.attributes" />
   </xsd:attributeGroup>

   <xsd:complexType name="table.td.type" mixed="true">
     <xsd:attributeGroup name="table.attributes" />
   </xsd:complexType>

   <xsd:complexType name="table.tr.type">
     <xsd:sequence maxOccurs="unbounded">
       <xsd:element name="td" type="table.td.type" />
     </xsd:sequence>
     <xsd:attributeGroup name="table.attributes" />
   </xsd:complexType>

   <xsd:complexType name="table.type">
     <xsd:sequence maxOccurs="unbounded">
       <xsd:element name="tr" type="table.tr.type" />
     </xsd:sequence>
     <xsd:attributeGroup name="table.attributes" />
   </xsd:complexType>

   <xsd:element name="table" type="table.type" />

<?context-block end table ?>


<?context-block begin tabulate ?>

   <xsd:complexType name="tabulate.td.type" mixed="true">
   </xsd:complexType>

   <xsd:complexType name="tabulate.tr.type">
     <xsd:sequence maxOccurs="unbounded">
       <xsd:element name="td" type="tabulate.td.type" />
     </xsd:sequence>
   </xsd:complexType>

   <xsd:complexType name="tabulate.base.type">
     <xsd:sequence maxOccurs="unbounded">
       <xsd:element name="tr" type="tabulate.tr.type" />
     </xsd:sequence>
   </xsd:complexType>

   <xsd:complexType name="tabulate.align.value">
     <xsd:restriction base="xsd:string">
       <xsd:enumeration value="high" />
       <xsd:enumeration value="low"  />
       <xsd:enumeration value="lohi" />
     </xsd:restriction>
   </xsd:complexType>

   <xsd:attributeGroup name="tabulate.tcell.attributes">
     <xsd:attribute name="align" type="tabulate.align.value" />
   </xsd:attributeGroup>

   <xsd:complexType name="tabulate.tcell.type" mixed="true">
     <xsd:attributeGroup ref="tabulate.tcell.attributes" />
   </xsd:complexType>

   <xsd:complexType name="tabulate.tcell.type">
   </xsd:complexType>

   <xsd:complexType name="tabulate.tcells.type">
     <xsd:sequence maxOccurs="unbounded">
       <xsd:element name="tcell" type="tabulate.tcell.type" />
     </xsd:sequence>
   </xsd:complexType>

   <xsd:complexType name="tabulate.type">
     <xsd:sequence>
       <xsd:element name="tcells" type="tabulate.tcells.type" />
       <xsd:element name="thead" type="tabulate.base.type" minOccurs="0" 
maxOccurs="1" />
       <xsd:element name="ttail" type="tabulate.base.type" minOccurs="0" 
maxOccurs="1" />
       <xsd:element name="tbody" type="tabulate.base.type" minOccurs="1" 
maxOccurs="unbounded" />
     </xsd:sequence>
   </xsd:complexType>

   <xsd:element name="tabulate" type="tabulate.type" />

<?context-block end tabulate ?>


</xsd:schema>
\x1a
-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------

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

* Re: mag-0008
  2004-12-15 17:16       ` mag-0008 Hans Hagen
@ 2004-12-15 17:53         ` Bruce D'Arcus
  0 siblings, 0 replies; 9+ messages in thread
From: Bruce D'Arcus @ 2004-12-15 17:53 UTC (permalink / raw)
  Cc: ntg-context


On Dec 15, 2004, at 12:16 PM, Hans Hagen wrote:

> that was from the time that i played with schema's, nowadays i prefer 
> relax ng

Indeed!

It may be worth noting that the next generation versions of both 
DocBook and TEI:

	-	are developed in RELAX NG
	-	are namespaced
	-	are designed for customizability, including mixing-and-matching 
definitions across the schemas

Bruce

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

end of thread, other threads:[~2004-12-15 17:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-09 21:10 XML & <formula>s Adam Lindsay
2004-12-10 21:38 ` h h extern
2004-12-10 23:02   ` Adam Lindsay
2004-12-12 21:34     ` h h extern
2004-12-13 18:02   ` mag-0008 (was: XML & <formula>s) Adam Lindsay
2004-12-13 21:23     ` Bruce D'Arcus
2004-12-15 17:16       ` mag-0008 Hans Hagen
2004-12-15 17:53         ` mag-0008 Bruce D'Arcus
2004-12-15 17:14     ` mag-0008 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).