ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Antwort: Re: XML
@ 2005-09-22  7:53 Jessica Holle
  2005-09-23 14:29 ` Henning Hraban Ramm
  0 siblings, 1 reply; 4+ messages in thread
From: Jessica Holle @ 2005-09-22  7:53 UTC (permalink / raw)



There I don't find something which helps me.
The input must not be only XML. In can also be CVS or something
else...
thx

Jessica

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

* Re: Antwort: Re: XML
  2005-09-22  7:53 Antwort: Re: XML Jessica Holle
@ 2005-09-23 14:29 ` Henning Hraban Ramm
  2005-09-23 15:03   ` Adam Lindsay
  0 siblings, 1 reply; 4+ messages in thread
From: Henning Hraban Ramm @ 2005-09-23 14:29 UTC (permalink / raw)


Am 2005-09-22 um 09:53 schrieb Jessica Holle:

> There I don't find something which helps me.
> The input must not be only XML. In can also be CVS or something
> else...

You will have to convert your XML file to become a ConTeXt table, use  
XSLT or some scripting language.
ConTeXt's TABLE format ("HTML tables") is very suitable for such.


Grüßlis vom Hraban!
---
http://www.fiee.net/texnique/
http://contextgarden.net
http://www.cacert.org (I'm an assurer)

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

* Re: Antwort: Re: XML
  2005-09-23 14:29 ` Henning Hraban Ramm
@ 2005-09-23 15:03   ` Adam Lindsay
  2005-09-23 19:33     ` Christopher Creutzig
  0 siblings, 1 reply; 4+ messages in thread
From: Adam Lindsay @ 2005-09-23 15:03 UTC (permalink / raw)


Henning Hraban Ramm said this at Fri, 23 Sep 2005 16:29:17 +0200:

>Am 2005-09-22 um 09:53 schrieb Jessica Holle:
>
>> There I don't find something which helps me.
>> The input must not be only XML. In can also be CVS or something
>> else...
>
>You will have to convert your XML file to become a ConTeXt table, use  
>XSLT or some scripting language.
>ConTeXt's TABLE format ("HTML tables") is very suitable for such.

I'm not sure I understand the "CVS or something else" part from the
original poster, but XML-style tables can very feasibly be mixed with
other ConTeXt code:

\usemodule        [contml]  % load the simple default xml vocab
\autoXMLnamespace [context] % avoid prefixing elements w/ context:
\setupcolors      [state=start] % not necessary, helps with example

\starttext
\section{Some \ConTeXt}

\startXMLdata
<table frame="off" background="color" color="white">
<tr backgroundcolor="red">   <td>some</td> <td>XML</td> </tr>
<tr backgroundcolor="green"> <td>xx</td> <td>xx</td> </tr>
</table>
\stopXMLdata

I can also have normal \TeX-like 
\inframed[frame=off,background=color,backgroundcolor=yellow]
{markup}.

\stoptext

>Is it possible to fill a table or a document in ConTeXt with content
>from a XML file?

You can replace the \startXMLdata-\stopXMLdata block with (in this case)
\processXMLfilegrouped{table.xml} where table.xml holds a table similar
to the above.
-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 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] 4+ messages in thread

* Re: Antwort: Re: XML
  2005-09-23 15:03   ` Adam Lindsay
@ 2005-09-23 19:33     ` Christopher Creutzig
  0 siblings, 0 replies; 4+ messages in thread
From: Christopher Creutzig @ 2005-09-23 19:33 UTC (permalink / raw)


Adam Lindsay wrote:

> I'm not sure I understand the "CVS or something else" part from the

 Probably a typo for CSV, comma-seperated values.

 It should be rather easy to typeset csv data in table format.  The
following tentative code ignores the fact that csv data may optionally
be enclosed in "" quotes that have to be removed (to be done in
TBLentry) and that these quoted strings may contain commas themselves
(which means writing a custom version of \processcommalist instead).
Apart from that, it seems to work.  (I just felt an urge of creativism,
so I took up the challenge.)


\def\TBLentry#1{\bTD#1\eTD}
\def\TBLline#1{\bTR\processcommalist[#1]\TBLentry}

% Iterate over all the lines of text captured with \obeylines active
% command to call is first argument, is not called for empty lines
\bgroup
\obeylines
\gdef\ProcessLines#1#2{\doProcessLines{#1}#2^^M\doProcessLines}%
\gdef\doProcessLines#1#2^^M#3\doProcessLines{%
  \doifnotempty{#2}{#1{#2}}%
  \doifnotempty{#3}{\doProcessLines{#1}#3\doProcessLines}%
}%
\egroup

\def\startCSV{\bgroup\obeylines\dostartCSV}

\def\dostartCSV#1\stopCSV{%
   \bTABLE
   \ProcessLines\TBLline{#1}%
   \eTABLE
   \egroup
}


\starttext
CSV test:

\startCSV
a,b,c,d,e
1,2,3,4,5
6,7,8,9,10
some text,11,12,,14
\stopCSV

\stoptext


 Hans, what goodies of ConTeXt did I miss?  Is the above sufficiently
ConTeXtish to be wikiable?


regards,
	Christopher

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

end of thread, other threads:[~2005-09-23 19:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-22  7:53 Antwort: Re: XML Jessica Holle
2005-09-23 14:29 ` Henning Hraban Ramm
2005-09-23 15:03   ` Adam Lindsay
2005-09-23 19:33     ` Christopher Creutzig

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).