Changes

Jump to navigation Jump to search
806 bytes added ,  08:10, 28 March 2013
no edit summary
== General ==
If you process xml with ConTeXt Mkiv, you have the power of the Lua language at your fingertips. All <code>\xml...</code> commands have their Lua counterparts. Unfortunately, this is not yet fully documented, so this wiki page is a place-holder until Hans finishes this section in [http://pragma-ade.com/show-man-43.htm Mkiv manual].
 
A few general observations to help you getting started:
* There are two sets of Lua commands: the xml... commands allow you to work with the content of your xml elements within Lua; lxml... commands pass the content to ConTeXt and typeset it.
* Both commands receive the content as a Lua table.
 
Now let's get started with a silly example to show you what we can do in Lua.
 
== The xml file ==
Here is the 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>
<item>
<model>Volkswagen</model>
<price>12000</price>
</item>
<item>
<model>Mercedes</model>
<price>35000</price>
</item>
<item>
<model>Ferrari</model>
<price>150000</price>
</item>
</list>
</xmlcode>
gardener
111

edits

Navigation menu