ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Subject: Re: XML and title page rule
Date: Fri, 24 Mar 2006 10:12:16 +0100	[thread overview]
Message-ID: <4423B7F0.6050700@wxs.nl> (raw)
In-Reply-To: <200603232036.43104.graumann@caltech.edu>

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

  reply	other threads:[~2006-03-24  9:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-24  4:36 Johannes Graumann
2006-03-24  9:12 ` Hans Hagen [this message]
2006-03-24 18:04   ` Johannes Graumann
2006-03-28 16:12   ` Jano Kula
2006-03-28 16:40     ` Hans Hagen
2006-03-28 17:38       ` Jano Kula
2006-03-29 14:15     ` documents to (print and) read Geert Stappers
2006-03-30  8:38       ` Taco Hoekwater
2006-04-03 17:43         ` Jano Kula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4423B7F0.6050700@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).