G’Day, Having a first go at converting TEI XML to ConTeXt. Steep learning curve, but easier (for me) than XSLT, and first results were amazing. Using http://www.pragma-ade.com/general/manuals/xml-mkiv.pdf as a guide. Currently stuck on converting an ISO format date (eg. 1908-01-10) into something more readable (eg. 10 January 1908) in the output. I presume I should create a function (?luacode) that can take any ISO value and output the readable form. The following works but seems to me inefficient. Grateful for any pointers. Mike Here is my MWE: \startbuffer[demo]
10.I.08 19 Mar '08
\stopbuffer \startxmlsetups xml:initialize \xmlsetsetup{#1}{date}{xml:date} \stopxmlsetups \xmlregistersetup{xml:initialize} \startxmlsetups xml:date \xmldoifelse {#1}{.[@type='divDate']} { \def\docdate{\ctxlua{ local tyear = string.sub('\xmlatt{#1}{when-iso}',1,4) local tmonth = string.sub('\xmlatt{#1}{when-iso}',6,7) local tday = string.sub('\xmlatt{#1}{when-iso}',9,10) context.date{d = tday, m = tmonth, y = tyear} }} \docdate[day,month,year] = Document Date \par } { \def\docdate{\ctxlua{ local tyear = string.sub('\xmlatt{#1}{when-iso}',1,4) local tmonth = string.sub('\xmlatt{#1}{when-iso}',6,7) local tday = string.sub('\xmlatt{#1}{when-iso}',9,10) context.date{d = tday, m = tmonth, y = tyear} }} \docdate[day,month,year] = Event Date\par } \stopxmlsetups \starttext \xmlprocessbuffer{main}{demo}{} \stoptext