[NTG-context] Fwd: Re: xml-processing: missing or ungrouped '='

Thomas A. Schmitz thomas.schmitz at uni-bonn.de
Sat Jan 8 18:00:59 CET 2011


On Jan 8, 2011, at 3:23 PM, Achim Jander wrote:

> Hi Thomas,
> yes, of course you are right, but thats not making the problems. Its switched in while making a "minimal" example.
> My problem or maxbe misunderstanding ist what I try to achieve with

Sorry, but I still don't have the faintest idea what it is you want to do. Your minimal example doesn't show it, and your explanations differ from one message to the next. 

In one of your mails, you said this:

> If the title comes with an number-element  I want to set ownnumber=..., but if they have no numbers, I want to set number=no

If this is what you're looking for, here's what I would suggest:

\startbuffer[test]
<a>
 <chapter title="some text">
   <b>more text </b>
   <b>more text </b>
 </chapter>
 <chapter num="333" title="more text">
   <b>more text </b>
   <b>more text </b>
 </chapter>
</a>
\stopbuffer

\startxmlsetups xml:testsetups
  \xmlsetsetup{\xmldocument}{a|b|chapter}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:testsetups}

\startxmlsetups xml:a
  \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:b
  \startparagraph
  \xmlflush{#1}
  \stopparagraph
\stopxmlsetups

\startxmlsetups xml:chapter
 \doifelse {\xmlatt{#1}{num}} {}
 {\setuphead[chapter][number=no]
  \startchapter[title={\xmlatt{#1}{title}}]
    \xmlflush{#1}
  \stopchapter}
 {\setuphead[chapter][number=yes]
  \setupheadnumber[chapter][\xmlatt{#1}{num}]
  \startchapter[title={\xmlatt{#1}{title}}] 
    \xmlflush{#1}
  \stopchapter}
\stopxmlsetups

\starttext
\xmlprocessbuffer{main}{test}{}
\stoptext

It's trivial to change the test from an attribute to a <num> element>, but maybe that's not what you're looking for...

Thomas


More information about the ntg-context mailing list