Changes

Jump to navigation Jump to search
1,101 bytes added ,  08:15, 28 March 2013
no edit summary
== The xml file ==
Here is the prices.xml file that we will be processing, a price list for cars. Prices are given in Euros; this used to be a currency in some countries in Europe:
<xmlcode>
</list>
</xmlcode>
 
== The ConTeXt style file ==
Next, we write the environment file which we will use to process our list. As an exercise, we will use Lua for all xml elements (though this doesn't make sense in most cases). If you have already read the [http://pragma-ade.com/show-man-43.htm manual], most of this will be familiar. The first line connects our environment with the Lua file where all the Lua code will go. The last lines set up a table, since this is how we want to display the information:
 
<texcode>
\registerctxluafile{l-prices}{1.001}
 
\startxmlsetups xml:pricesetups
\xmlsetsetup{#1}{list|
item|
model|
price}{xml:*}
\stopxmlsetups
 
\xmlregistersetup{xml:pricesetups}
 
\startxmlsetups xml:list
\xmlfunction{#1}{list}
\stopxmlsetups
 
\startxmlsetups xml:item
\xmlfunction{#1}{item}
\stopxmlsetups
 
\startxmlsetups xml:model
\xmlfunction{#1}{model}
\stopxmlsetups
 
\startxmlsetups xml:price
\xmlfunction{#1}{price}
\stopxmlsetups
 
\setupTABLE [column] [1] [style=bold,width=0.3\textwidth]
\setupTABLE [column] [2,3,4] [style=italic,width=0.2\textwidth]
</texcode>
gardener
111

edits

Navigation menu