ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* First example in xml-mkiv.pdf
@ 2018-06-05 20:03 Keith McKay
  2018-06-06 13:32 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Keith McKay @ 2018-06-05 20:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

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


[-- Attachment #1.2: Type: text/html, Size: 8388 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: First example in xml-mkiv.pdf
  2018-06-05 20:03 First example in xml-mkiv.pdf Keith McKay
@ 2018-06-06 13:32 ` Hans Hagen
  2018-06-06 13:38   ` Keith McKay
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2018-06-06 13:32 UTC (permalink / raw)
  To: ntg-context@ntg.nl >> mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: First example in xml-mkiv.pdf
  2018-06-06 13:32 ` Hans Hagen
@ 2018-06-06 13:38   ` Keith McKay
  0 siblings, 0 replies; 3+ messages in thread
From: Keith McKay @ 2018-06-06 13:38 UTC (permalink / raw)
  To: ntg-context


[-- 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-06 13:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-05 20:03 First example in xml-mkiv.pdf Keith McKay
2018-06-06 13:32 ` Hans Hagen
2018-06-06 13:38   ` Keith McKay

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).