[NTG-context] First example in xml-mkiv.pdf

Keith McKay mckaymeister at gmail.com
Tue Jun 5 22:03:51 CEST 2018


Dear List,

In my continuing effort to improve my ConTeXt skills I thought I would 
have a look at XML and ConTeXt. Note: I have no XML skills but, "in for 
a penny, in for a pound", as they say over here. I started by looking at 
the very first example on page 5 of "Dealing with XML in ConTeXt mkiv" 
and straight away hit a problem.  There is a typo in the first line of 
the XML file which I corrected:

<?xml version='1.0' standalone='yes?>

should be

<?xml version="1.0" standalone="yes"?>

However when I ran the file using the tex file it only produced a 3 page 
pdf with a contents page and 2 title pages and no other text.

Here is the XML file which is the similar to the one on page 5 but with 
two sections rather than one:

<?xml version="1.0" standalone="yes"?>

<document>

<section>

<title>Some title</title>

<content>

<p>a paragraph of text</p>

<p>another paragraph of text</p>

</content>

</section>

<section>

<title>Another title</title>

<content>

<p>a paragraph of text</p>

<p>another paragraph of text</p>

</content>

</section>

</document>

The TeX file is cut and pasted from pages 5 and 6 of xml-mkiv.pdf:

\startxmlsetups xml:demo:base

\xmlsetsetup{#1}{document|section|p|itemize|item}{xml:demo:*}

\stopxmlsetups

\xmlregisterdocumentsetup{demo}{xml:demo:base}

\startxmlsetups xml:demo:document

\starttitle[title={Contents}]

\placelist[chapter]

\stoptitle

\xmlflush{#1}

\stopxmlsetups

\startxmlsetups xml:demo:section

\startchapter[title=\xmlfirst{#1}{/title}]

\xmlfirst{#1}{/content}

\stopchapter

\stopxmlsetups

\startxmlsetups xml:demo:p

\xmlflush{#1}\endgraf

\stopxmlsetups

\xmlprocessfile{demo}{demo.xml}{}

This seemed such a simple example and I'm a bit perplexed as to why it 
did not work. Can somebody explain why no paragraphs are showing up? I'm 
using:

ConTeXt ver: 2018.04.04 00:51 MKIV beta fmt: 2018.6.2 int: english/english

LuaTeX, Version 1.07.0 (TeX Live 2018)

Thanks and Best Wishes

Keith McKay

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20180605/d26b4bf4/attachment.html>


More information about the ntg-context mailing list