ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Keith McKay <mckaymeister@gmail.com>
To: ntg-context@ntg.nl
Subject: Re: First example in xml-mkiv.pdf
Date: Wed, 6 Jun 2018 14:38:50 +0100	[thread overview]
Message-ID: <a606a95b-5837-1b0a-186c-401dc2062e1c@gmail.com> (raw)
In-Reply-To: <58c51bf2-eab2-c1f9-972d-2de8871fb908@xs4all.nl>


[-- Attachment #1.1: Type: text/plain, Size: 4664 bytes --]

Aah yes, how silly of me to forget to add \starttext... \stoptext! 
Thanks for your help.

Best Wishes

Keith


On 06/06/2018 14:32, Hans Hagen wrote:
> On 6/5/2018 10:03 PM, Keith McKay wrote:
>> 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
> you need to add \starttext ... \stoptext
>
> \startbuffer[demo]
> <?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>
> \stopbuffer
>
> \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
>
> \starttext
>     \xmlprocessbuffer{demo}{demo}{}
> \stoptext
>
>
> -----------------------------------------------------------------
>                                           Hans Hagen | PRAGMA ADE
>               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -----------------------------------------------------------------
> ___________________________________________________________________________________ 
>
> If your question is of interest to others as well, please add an entry 
> to the Wiki!
>
> maillist : ntg-context@ntg.nl / 
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________



[-- Attachment #1.2: Type: text/html, Size: 8415 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

      reply	other threads:[~2018-06-06 13:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-05 20:03 Keith McKay
2018-06-06 13:32 ` Hans Hagen
2018-06-06 13:38   ` Keith McKay [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a606a95b-5837-1b0a-186c-401dc2062e1c@gmail.com \
    --to=mckaymeister@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).