Antwort: Re: [NTG-context] XML
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
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)
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 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
participants (4)
-
Adam Lindsay
-
Christopher Creutzig
-
Henning Hraban Ramm
-
Jessica Holle