Johannes Graumann wrote:
> Hello,
>
> I'm trying to make the following work:
> 1) XML:
> <titlepage 
>   authors="Autor Autor"
>   title="Something &emdash; or <i>Something else</i>"
>   subtitle="Much Fun"
>   publisher="Somebody"
> />
> 2) ConTeXt translation rule:
> \defineXMLargument[titlepage]{%
>   \startstandardmakeup
>     \vfil
>     \bfd \setupinterlinespace Whatever \par
>     \bfb \setupinterlinespace You Want \par
>     \vfil
>     \vfil
>   \stopstandardmakeup
> }
>
> I was intending to feed the variables in through '\XMLvar', but can't get the 
> start working (see 2).). I would be grateful if someone could nudge me into 
> the right direction ...
> Is it even possible to have XML nodes in the variables evaluated ("<i>")?
> If the above isn't feasible: how would I write an import rule for something 
> like:
> <titlepage>
>   <authors>Autor Autor</authors>
>   <title>Something &emdash; or <i>Something else</i></title>
>   <subtitle>Much Fun</subtitle>
>   <publisher>Somebody</publisher>
> </titlepage>
>
> Thanks for any hints - need sleep now ...
>   
\starttext

\defineXMLgrouped [i] {\em} {}

\defineXMLcommand
  [titlepage]
  {\startstandardmakeup
     \vfil
     \bfd \setupinterlinespace \XMLop{title} \par
     \bfb \setupinterlinespace \XMLop{authors} \par
     \vfil
     \vfil
   \stopstandardmakeup}

\startXMLdata
<titlepage
  authors="Autor Autor 1"
  title="Something &emdash; or Something else"
  subtitle="Much Fun"
  publisher="Somebody"
/>
\stopXMLdata

\defineXMLenvironment
  [titlepage]
  {\defineXMLsave[authors]
   \defineXMLsave[title]
   \defineXMLsave[subtitle]
   \defineXMLsave[publisher]
   \startXMLignore} % ignore undefined elements
  {\stopXMLignore
   \startstandardmakeup
     \vfil
     \bfd \setupinterlinespace \XMLflush{title}   \par
     \bfb \setupinterlinespace \XMLflush{authors} \par
     \vfil
     \vfil
   \stopstandardmakeup}

\startXMLdata
<titlepage>
  <authors>Autor Autor 2</authors>
  <title>Something &emdash; or <i>Something else</i></title>
  <subtitle>Much Fun</subtitle>
  <publisher>Somebody</publisher>
</titlepage>
\stopXMLdata

\stoptext

Here is the hint - needs to be wikified now ... -) 

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

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to