Problem with XML entities in titles [2]
![](https://secure.gravatar.com/avatar/4ca783d52d05513bcc4d15922506c389.jpg?s=120&d=mm&r=g)
Hello Hans, some time ago I've reported this problem with character entities. I've just upgraded to ConTeXt 2007-09-28, and the problem still persists! Could you please look into it? A simple test file is attached. Many thanks, Richard _____ From: Richard Gabriel [mailto:rgabriel@kerio.com] To: ntg-context@ntg.nl Cc: Hans Hagen [mailto:pragma@wxs.nl] Sent: Wed, 15 Aug 2007 09:35:52 +0200 Subject: [NTG-context] Problem with XML entities in titles Hello Hans, I'd like to report a problem (bug) with XML entities in chapter or section titles. I've just upgraded to the recent ConTeXt version (2007.08.09) and started to get errors while processing the .tuo file. Please test the attached minimal example. During the second TeX run, I get the following error: --- cut --- (./test.tuo ! Misplaced alignment tab character &. <argument> This is a testing chapter \listtextcommand #1->\begstrut #1 \endstrut \doattributes ...sname #1#2\@EA \endcsname \fi {#4}\dostopattributes <argument> ...ry {This is a testing chapter}} \egroup \ifdim \wd 4=\zero... \secondoftwoarguments #1#2->#2 \dosomelistelement ...hss \dostoplistattributes }} \endgraf \nointerlineskip ... ... l.29 ...p;testing chapter}{2--0-1-0-0-0-0-0--2}{2} --- cut --- (find the complete log in attachment) Till today, I have been using ConTeXt version 2007.04.17 and it had worked fine! Thanks, Richard
![](https://secure.gravatar.com/avatar/6114858d84b0f40cf715f12237ab67a1.jpg?s=120&d=mm&r=g)
On 10/4/07, Richard Gabriel wrote:
Hello Hans,
some time ago I've reported this problem with character entities. I've just upgraded to ConTeXt 2007-09-28, and the problem still persists!
For Hans: just in case that you decide to fix this mkii issue & implement it in mkiv at the same time, here's something to start with: http://www.w3.org/TR/2002/REC-xhtml1-20020801/DTD/xhtml-lat1.ent http://www.w3.org/TR/2002/REC-xhtml1-20020801/DTD/xhtml-special.ent http://www.w3.org/TR/2002/REC-xhtml1-20020801/DTD/xhtml-symbol.ent http://www.w3.org/TR/2002/REC-xhtml1-20020801/dtds.html#h-A2 Mojca
![](https://secure.gravatar.com/avatar/93131e1e6e2204bd13501390d768dbdc.jpg?s=120&d=mm&r=g)
2007/10/4, Richard Gabriel
Hello Hans,
some time ago I've reported this problem with character entities. I've just upgraded to ConTeXt 2007-09-28, and the problem still persists! Could you please look into it? A simple test file is attached.
Many thanks, Richard
Hello Richard, I'm not Hans but I can also give you a solution to your problem. This is related to your own definition for the chapter header and ConTeXt's mechanism to save the two pass information of the headers, you should save the header text and expand the header command with the header text, you can use my example for your problem. BTW: Your xml file is valied because you forgot to include the chapter end tag. \defineXMLenvironment [chapter] {\defineXMLsave[title]} {\expanded{\chapter{\XMLflush{title}}}} \defineXMLenvironment[para] \dontleavehmode \par \defineXMLentities [tex] {tex} {\TeX} \starttext \completecontent \startXMLdata <chapter><title>This is a testing &tex; chapter</title></chapter> <para>Some meaningless text...</para> \stopXMLdata \stoptext Wolfgang
![](https://secure.gravatar.com/avatar/4ca783d52d05513bcc4d15922506c389.jpg?s=120&d=mm&r=g)
Hello Wolfgang, thanks for Your hint.
I'm not Hans but I can also give you a solution to your problem. OK, sorry, maybe I shouldn't address Hans directly when writing to the mailing list... ;-)
BTW: Your xml file is valied because you forgot to include the chapter end tag.
Ooops! I've quickly created a minimal test file; of course I didn't want to attach the real file where I've encountered that problem...
Anyway, the XML file is structured the following way:
<chapter><title>This is a testing chapter</title>
<para>Some meaningless text...</para>
</chapter>
<chapter><title>So — let's see</title>
<para>Some meaningless text...</para>
</chapter>
... the paragraphs are enclosed inside chapters.
So unfortunately I can't use your solution because the \chapter command needs to be issued at the beginning, not at the end tag.
Got any another idea?
Many thanks,
Richard
_____
From: Wolfgang Schuster [mailto:schuster.wolfgang@googlemail.com]
To: mailing list for ConTeXt users [mailto:ntg-context@ntg.nl]
Sent: Thu, 04 Oct 2007 13:47:27 +0200
Subject: Re: [NTG-context] Problem with XML entities in titles [2]
2007/10/4, Richard Gabriel
Hello Hans,
some time ago I've reported this problem with character entities. I've just upgraded to ConTeXt 2007-09-28, and the problem still persists! Could you please look into it? A simple test file is attached.
Many thanks, Richard
Hello Richard, I'm not Hans but I can also give you a solution to your problem. This is related to your own definition for the chapter header and ConTeXt's mechanism to save the two pass information of the headers, you should save the header text and expand the header command with the header text, you can use my example for your problem. BTW: Your xml file is valied because you forgot to include the chapter end tag. \defineXMLenvironment [chapter] {\defineXMLsave[title]} {\expanded{\chapter{\XMLflush{title}}}} \defineXMLenvironment[para] \dontleavehmode \par \defineXMLentities [tex] {tex} {\TeX} \starttext \completecontent \startXMLdata <chapter><title>This is a testing &tex; chapter</title></chapter> <para>Some meaningless text...</para> \stopXMLdata \stoptext Wolfgang ___________________________________________________________________________________ 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
![](https://secure.gravatar.com/avatar/4ca783d52d05513bcc4d15922506c389.jpg?s=120&d=mm&r=g)
Hello once again, I've puzzled my brain for a while ;-) and then I came to the following solution: \def\ExChapter#1{ \expanded{\chapter{#1}} } \defineXMLcommand[chapter]{ \defineXMLargument[title]\ExChapter }
From the first tests, it seems to work fine, anyway, I'm not sure if it won't break anything else... :-/ Anyway, thank for your hint with the expansion!
-Richard
_____
From: Wolfgang Schuster [mailto:schuster.wolfgang@googlemail.com]
To: mailing list for ConTeXt users [mailto:ntg-context@ntg.nl]
Sent: Thu, 04 Oct 2007 13:47:27 +0200
Subject: Re: [NTG-context] Problem with XML entities in titles [2]
2007/10/4, Richard Gabriel
Hello Hans,
some time ago I've reported this problem with character entities. I've just upgraded to ConTeXt 2007-09-28, and the problem still persists! Could you please look into it? A simple test file is attached.
Many thanks, Richard
Hello Richard, I'm not Hans but I can also give you a solution to your problem. This is related to your own definition for the chapter header and ConTeXt's mechanism to save the two pass information of the headers, you should save the header text and expand the header command with the header text, you can use my example for your problem. BTW: Your xml file is valied because you forgot to include the chapter end tag. \defineXMLenvironment [chapter] {\defineXMLsave[title]} {\expanded{\chapter{\XMLflush{title}}}} \defineXMLenvironment[para] \dontleavehmode \par \defineXMLentities [tex] {tex} {\TeX} \starttext \completecontent \startXMLdata <chapter><title>This is a testing &tex; chapter</title></chapter> <para>Some meaningless text...</para> \stopXMLdata \stoptext Wolfgang ___________________________________________________________________________________ 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
Richard Gabriel wrote:
Hello once again,
I've puzzled my brain for a while ;-) and then I came to the following solution:
\def\ExChapter#1{ \expanded{\chapter{#1}} }
\defineXMLcommand[chapter]{ \defineXMLargument[title]\ExChapter }
in mkiv ... this becomes: (1) register handler in setup ssection \xmlsetsetups {main} {chapter} {*} (2) access child element using lpath \startxmlsetups chapter \expanded{\chapter{ \xmlfirst{#1}{title} }} \stopxmlsetups ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/4ca783d52d05513bcc4d15922506c389.jpg?s=120&d=mm&r=g)
Hans, \xmlsetsetups throws "Undefined control sequence"... (ConTeXt 2007.09.28) ?! R. _____ From: Hans Hagen [mailto:pragma@wxs.nl] To: mailing list for ConTeXt users [mailto:ntg-context@ntg.nl] Sent: Thu, 04 Oct 2007 20:26:14 +0200 Subject: Re: [NTG-context] Problem with XML entities in titles [2] Richard Gabriel wrote:
Hello once again,
I've puzzled my brain for a while ;-) and then I came to the following solution:
\def\ExChapter#1{ \expanded{\chapter{#1}} }
\defineXMLcommand[chapter]{ \defineXMLargument[title]\ExChapter }
in mkiv ... this becomes: (1) register handler in setup ssection \xmlsetsetups {main} {chapter} {*} (2) access child element using lpath \startxmlsetups chapter \expanded{\chapter{ \xmlfirst{#1}{title} }} \stopxmlsetups ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
Richard Gabriel wrote:
Hans,
\xmlsetsetups throws "Undefined control sequence"...
as said ...
in mkiv ... this becomes:
so you need luatex btw, you can then also do things like: \xmlfirst{#1}{b[position() > 2 and position() < 5 and text() == 'ok']} \xmlfirst{#1}{b[position() > 2 and position() < 5 and text() == upper('ok')]} \xmlfirst{#1}{b[@n=='03' or @n=='08']} \xmlall {#1}{b[number(@n)>2 and number(@n)<6]} \xmlfirst{#1}{b[find(text(),'ALSO')]} and other complex path stuff Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/4ca783d52d05513bcc4d15922506c389.jpg?s=120&d=mm&r=g)
Oh so, thanks Hans and Thomas! Maybe I've been sleeping too long. :-) I'm going to setup luatex... -Richard _____ From: Hans Hagen [mailto:pragma@wxs.nl] To: mailing list for ConTeXt users [mailto:ntg-context@ntg.nl] Sent: Fri, 05 Oct 2007 13:53:14 +0200 Subject: Re: [NTG-context] Problem with XML entities in titles [2] Richard Gabriel wrote:
Hans,
\xmlsetsetups throws "Undefined control sequence"...
as said ...
in mkiv ... this becomes:
so you need luatex btw, you can then also do things like: \xmlfirst{#1}{b[position() > 2 and position() < 5 and text() == 'ok']} \xmlfirst{#1}{b[position() > 2 and position() < 5 and text() == upper('ok')]} \xmlfirst{#1}{b[@n=='03' or @n=='08']} \xmlall {#1}{b[number(@n)>2 and number(@n)<6]} \xmlfirst{#1}{b[find(text(),'ALSO')]} and other complex path stuff Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
Thomas A. Schmitz wrote:
On Oct 5, 2007, at 12:06 PM, Richard Gabriel wrote:
Hans,
\xmlsetsetups throws "Undefined control sequence"... (ConTeXt 2007.09.28)
?!
R.
With --luatex?
see wiki .. you also need luatex itself ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/4ca783d52d05513bcc4d15922506c389.jpg?s=120&d=mm&r=g)
Thanks Hans. Please excuse me for my impertinence, but why is any backward compatibility not kept? Why suddenly stopped working what did work for years? :-( Well, OK, I'm going to start with luatex... ;-) Thanks, R. _____ From: Hans Hagen [mailto:pragma@wxs.nl] To: mailing list for ConTeXt users [mailto:ntg-context@ntg.nl] Sent: Fri, 05 Oct 2007 16:16:50 +0200 Subject: Re: [NTG-context] Problem with XML entities in titles [2] Thomas A. Schmitz wrote:
On Oct 5, 2007, at 12:06 PM, Richard Gabriel wrote:
Hans,
\xmlsetsetups throws "Undefined control sequence"... (ConTeXt 2007.09.28)
?!
R.
With --luatex?
see wiki .. you also need luatex itself ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
Richard Gabriel wrote:
Thanks Hans. Please excuse me for my impertinence, but why is any backward compatibility not kept? Why suddenly stopped working what did work for years? :-(
Well, OK, I'm going to start with luatex... ;-)
the new mechanism is not replacing the old ... can even be used mixed the new one is based on loading the tree and selective flushing; more manipulative power and much faster too (the xml interpreter is written in lua and (on my machine) loads 5meg/sec into a tree Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (5)
-
Hans Hagen
-
Mojca Miklavec
-
Richard Gabriel
-
Thomas A. Schmitz
-
Wolfgang Schuster