ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* XML and references
@ 2006-04-03  0:51 Johannes Graumann
  2006-04-03  8:20 ` Taco Hoekwater
  2006-04-03  8:43 ` Hans Hagen
  0 siblings, 2 replies; 4+ messages in thread
From: Johannes Graumann @ 2006-04-03  0:51 UTC (permalink / raw)


Hello all,

I'm trying to interpret something like
<section label="intro:mixtureprob">
  <title>The problem of the complex protein mixture</title>
  <content>
    <ref name="intro:mixtureprob"/>
  </content>
</section>

With the follwing mapping rules and am failing:
\defineXMLenvironment
  [section]
  {
  \defineXMLargument
    [title]
    [\XMLpar{section}{label}{}]
    {\section}
  \defineXMLenvironment
    [content]
    {}{}
  }
  {}
\defineXMLargument  
  [ref]
  {\textreference[\XMLpar{ref}{name}{}]}

I would appreciate any insight into my folly ...

Thanks, Joh

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

* Re: XML and references
  2006-04-03  0:51 XML and references Johannes Graumann
@ 2006-04-03  8:20 ` Taco Hoekwater
  2006-04-03  8:43 ` Hans Hagen
  1 sibling, 0 replies; 4+ messages in thread
From: Taco Hoekwater @ 2006-04-03  8:20 UTC (permalink / raw)




Johannes Graumann wrote:
> Hello all,
> 
> I'm trying to interpret something like
> <section label="intro:mixtureprob">
>   <title>The problem of the complex protein mixture</title>
>   <content>
>     <ref name="intro:mixtureprob"/>
>   </content>
> </section>
> 

1. you never match the section label to the \section head, so you
    need something like this:

    \defineXMLargument
      [title]
      [\XMLpar{section}{label}{}]
      {\section[\XMLpar{section}{label}{}]}

2. \textreference *creates* a reference instead of referring
    to one, so you need

    \defineXMLargument
      [ref]
      {\in[\XMLpar{ref}{name}{}]}

Cheers, Taco

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

* Re: XML and references
  2006-04-03  0:51 XML and references Johannes Graumann
  2006-04-03  8:20 ` Taco Hoekwater
@ 2006-04-03  8:43 ` Hans Hagen
  2006-04-03 15:27   ` Johannes Graumann
  1 sibling, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2006-04-03  8:43 UTC (permalink / raw)


Johannes Graumann wrote:
> Hello all,
>
> I'm trying to interpret something like
> <section label="intro:mixtureprob">
>   <title>The problem of the complex protein mixture</title>
>   <content>
>     <ref name="intro:mixtureprob"/>
>   </content>
> </section>
>
> With the follwing mapping rules and am failing:
> \defineXMLenvironment
>   [section]
>   {
>   \defineXMLargument
>     [title]
>     [\XMLpar{section}{label}{}]
>   
wrong argument, should be [name=]
>     {\section}
>   \defineXMLenvironment
>     [content]
>     {}{}
>   }
>   {}
> \defineXMLargument  
>   [ref]
>   {\textreference[\XMLpar{ref}{name}{}]}
>   
wrong command \textreference should be \in
> I would appreciate any insight into my folly ...
>
> Thanks, Joh
>   
\defineXMLenvironment
  [section]
  {\setups{section:define}}
  {}

\startsetups section:define
  \defineXMLargument
    [title]
    [label=]
    {\expanded{\section[\XMLpar{section}{label}{}]}}
  \defineXMLprocess
    [content]
\stopsetups

\defineXMLenvironmentsave
  [pageref]
  [name=]
  {}
  {\at{\XMLflush{pageref}}[\XMLop{name}]}
\defineXMLenvironmentsave
  [textref]
  [name=]
  {}
  {\in{\XMLflush{textref}}[\XMLop{name}]}

\starttext

\startXMLdata
<section label="intro:mixtureprob">
  <title>The problem of the complex protein mixture</title>
  <content>
    <pageref name="intro:mixtureprob"/>
    <textref name="intro:mixtureprob"/>
    <pageref name="intro:mixtureprob">page</pageref>
    <textref name="intro:mixtureprob">chapter</textref>
  </content>
</section>
\stopXMLdata

\stoptext


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

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

* Re: XML and references
  2006-04-03  8:43 ` Hans Hagen
@ 2006-04-03 15:27   ` Johannes Graumann
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Graumann @ 2006-04-03 15:27 UTC (permalink / raw)


Hans,

When this is done, I will have to make a trip to Zwolle and buy you a beer!
Thank you once again!

Joh

Hans Hagen wrote:

> Johannes Graumann wrote:
>> Hello all,
>>
>> I'm trying to interpret something like
>> <section label="intro:mixtureprob">
>>   <title>The problem of the complex protein mixture</title>
>>   <content>
>>     <ref name="intro:mixtureprob"/>
>>   </content>
>> </section>
>>
>> With the follwing mapping rules and am failing:
>> \defineXMLenvironment
>>   [section]
>>   {
>>   \defineXMLargument
>>     [title]
>>     [\XMLpar{section}{label}{}]
>>   
> wrong argument, should be [name=]
>>     {\section}
>>   \defineXMLenvironment
>>     [content]
>>     {}{}
>>   }
>>   {}
>> \defineXMLargument
>>   [ref]
>>   {\textreference[\XMLpar{ref}{name}{}]}
>>   
> wrong command \textreference should be \in
>> I would appreciate any insight into my folly ...
>>
>> Thanks, Joh
>>   
> \defineXMLenvironment
>   [section]
>   {\setups{section:define}}
>   {}
> 
> \startsetups section:define
>   \defineXMLargument
>     [title]
>     [label=]
>     {\expanded{\section[\XMLpar{section}{label}{}]}}
>   \defineXMLprocess
>     [content]
> \stopsetups
> 
> \defineXMLenvironmentsave
>   [pageref]
>   [name=]
>   {}
>   {\at{\XMLflush{pageref}}[\XMLop{name}]}
> \defineXMLenvironmentsave
>   [textref]
>   [name=]
>   {}
>   {\in{\XMLflush{textref}}[\XMLop{name}]}
> 
> \starttext
> 
> \startXMLdata
> <section label="intro:mixtureprob">
>   <title>The problem of the complex protein mixture</title>
>   <content>
>     <pageref name="intro:mixtureprob"/>
>     <textref name="intro:mixtureprob"/>
>     <pageref name="intro:mixtureprob">page</pageref>
>     <textref name="intro:mixtureprob">chapter</textref>
>   </content>
> </section>
> \stopXMLdata
> 
> \stoptext
> 
> 
> -----------------------------------------------------------------
>                                           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
> -----------------------------------------------------------------

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

end of thread, other threads:[~2006-04-03 15:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-03  0:51 XML and references Johannes Graumann
2006-04-03  8:20 ` Taco Hoekwater
2006-04-03  8:43 ` Hans Hagen
2006-04-03 15:27   ` Johannes Graumann

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