I want to process documents from two separate XML files. One XML file defines the layout of the page ... placement of text boxes, fonts to use ... even placeholder text. The other XML contains the actual content that gets placed into that layout. Is this possible? Anyone have any examples of something like this? I'm a LaTeX user who's new to ConTeXt. I figured I can learn more quickly by starting with a "recipe" and modifying it to fit my needs. Thank you! -pd
On Thu, 11 Nov 2010, Peter Davis wrote:
I want to process documents from two separate XML files. One XML file defines the layout of the page ... placement of text boxes, fonts to use ... even placeholder text. The other XML contains the actual content that gets placed into that layout.
You can generate the \setup commands (i.e. the preable) from the first XML file, and the main body of the document from the second XML file. Aditya
On Thu, Nov 11, 2010 at 11:34 PM, Aditya Mahajan
On Thu, 11 Nov 2010, Peter Davis wrote:
I want to process documents from two separate XML files. One XML file
defines the layout of the page ... placement of text boxes, fonts to use ... even placeholder text. The other XML contains the actual content that gets placed into that layout.
You can generate the \setup commands (i.e. the preable) from the first XML file, and the main body of the document from the second XML file.
Thanks! The layout XML would actually define a kind of boilerplate page, and then various contents from the other XML would be inserted. The final document might have a thousand pages, all based on the same boilerplate, but with different contents inserted. So I'd need a mechanism for storing the boilerplate so that for each element in the content XML, I could generate a new page using the boilerplate plus the text from that element. Is that clear? It's kind of like mail merge in a word processor. You might get a few hundred or thousand copies of a letter, each for a different recipient. So in essence, one XML contains the letter, and the other contains the list of recipients, their addresses, etc. Thank you. -pd
On Fri, Nov 12, 2010 at 7:55 AM, Martin Schröder
2010/11/12 Peter Davis
: Is that clear?
It's called database publishing. :-)
Exactly. (Or sometimes variable data printing ... VDP.) I guess the "layout" XML file would basically be used to construct a macro that draws the page, and the "content" XML would basically invoke that macro with different arguments for each recipient. Does that seem like the most effective way to do this? Any examples of anything like this, or of using an XML to define a macro? Thank you. -pd
On 12 nov 2010, at 14:17, Peter Davis wrote:
On Fri, Nov 12, 2010 at 7:55 AM, Martin Schröder
wrote: 2010/11/12 Peter Davis : Is that clear?
It's called database publishing. :-)
Exactly. (Or sometimes variable data printing ... VDP.)
I guess the "layout" XML file would basically be used to construct a macro that draws the page, and the "content" XML would basically invoke that macro with different arguments for each recipient.
Does that seem like the most effective way to do this? Any examples of anything like this, or of using an XML to define a macro?
Thank you.
On tlcontrib.metatex.or I placed a series of ConTeXt modules under title "hvdm". Perhaps these are useful as a working example of how to separate various elements of xml-typesetting. Hope this helps. Hans van der Meer One xml-definition file (hvdm-xml.tex) in the package is used for general constructs, another (hvdm-dvd.tex) for typesetting "database"-entries in xml. As an example of data input: <!-- TEMPLATE FOR DVD-COVER DATA $Revision:: 43 $ $Date:: 2010-10-29 19:#$ --> <?xml version="1.0" encoding="UTF-8"?> <dvd filenumber="_FILENUMBER_" genre="_GENRE_"> <setup name="pdfcase" chaptername="off" left="" right=""/> <titles> <title>_TITLE_</title> </titles> <frontfigure commonsize="" maxwidth="" maxheight="" frame=""> <img src="" width="" height="" frame="" option=""/> </frontfigure> <recording> <recorded>_DATE_</recorded> <burned>_DATE_</burned> </recording> etc. simply called by a minimal header: \usemodule[hvdm-dvd] % xml conversions \DataLocation{/Volumes/Qrecordings/DVD/D026-D050/D050 Aux temps des croisades} \starttext \setupCase[DVD][state=draft] \xmlprocessfile{dvd}{\DATALOCATION data.xml}{} % start at the dvd root node \stoptext \endinput
On Fri, Nov 12, 2010 at 8:39 AM, Hans van der Meer
On tlcontrib.metatex.or I placed a series of ConTeXt modules under title "hvdm". Perhaps these are useful as a working example of how to separate various elements of xml-typesetting. Hope this helps.
Hans van der Meer
Thank you, Hans. I have downloaded this, and will take a closer look. Best, -pd
participants (4)
-
Aditya Mahajan
-
Hans van der Meer
-
Martin Schröder
-
Peter Davis