ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* xml in mkiv
@ 2008-06-03 18:13 Hans Hagen
  0 siblings, 0 replies; only message in thread
From: Hans Hagen @ 2008-06-03 18:13 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

[if you never use xml or don't use mkiv, you can skip this message]

Currently in mkiv, the mkii method of xml is active at the same time; 
however, this is not always what you want and eventually i suppose that 
mkiv xml usage will replace mkii usage (i'm thinking of at some point 
making the old stream based xml method a module for mkiv)

anyhow, one of aspects we need to deal with is mixed usage of documents, 
more about that later

the latest beta has a \setupxml command with the following options 
(there are a few more):

\setupxml[\c!method=mkii]                    % mixed mkiv and mkii
\setupxml[\c!method=mkiv,\c!default=]        % mkiv only
\setupxml[\c!method=mkiv,\c!default=\v!none] % mkiv only, undefined -> 
hidden
\setupxml[\c!method=mkiv,\c!default=\v!text] % mkiv only, undefined -> text

the tricky part is in dealing with entities. By default entities are 
resolved to utd code, which means that <, > and & are part if 
the normal text stream. This is tricky because in mkii a dangling < or & 
gives an error.

However, in mkii mode (i.e. mixed mode), these three characters are 
remapped to some place safe (the location in the unicode table will 
change once we have active chars in the private planes).

i used this test:

% \defineXMLenvironment[y]{(}{)}
%
% \startxmlsetups x
%     /\xmlflush{#1}/
% \stopxmlsetups
%
% \startxmlsetups xx
%     \xmlsetsetup{main}{x}{*}
% \stopxmlsetups
%
% \xmlregistersetup{xx}
%
% \startbuffer
% <x>a &lt;&amp;&gt;<y>{b}</y> c</x>
% \stopbuffer

Another change is that 'context --env=bla whatever.xml' will use mkiv 
xml mode unless the --mkii flag is passed. The alternative is rather 
ugly and tricky overloading of the traditional XML macros, an option 
that i rejected.

An example that demonstrates mkiv usage is:

   context --ctx=x-ldx l-dimen.lua

this will produce the documentation of l-dimen.lua and does a 
transformation as defined in the ctx file. Eventually all those texexec 
goodies (--pdfwhatever) will become such scripts combined with styles.

Much is experimental and I will add more control over specific 
documents. Take for instance (from x-ldx.tex):

\usemodule[mathml]

\xmlregisterdocumentsetup{ldx}{xml:mml:define}
\xmlregisterdocumentsetup{ldx}{xml:ldx:define}

\xmlregisterns{ldx}{ldx}

\startxmlsetups xml:ldx:define
     \xmlgrab {\xmldocument} {ldx:*} {*}
\stopxmlsetups

This associates the ldx definitions to the document but also mathml.

I'm converting all traditional xml handling used in the core into mkiv 
handling (e.g. clt handling is already converted; clt deals with 
remapping filesnames into the ones that come out of preprocessing, as 
for instance in the ldx module).

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
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-06-03 18:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-03 18:13 xml in mkiv 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).