ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Thomas A. Schmitz" <thomas.schmitz@uni-bonn.de>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: xml cross-references in lua?
Date: Tue, 11 Sep 2012 19:22:13 +0200	[thread overview]
Message-ID: <504F7345.6050309@uni-bonn.de> (raw)

Hi all,

I have a question about xml processing and I think that what I want/need 
can best be achieved by using lua code, but so far, I'm not really sure 
how to proceed, so any help from one of the resident lua gurus would be 
welcome.

So: the question. xml allows to provide elements with unique identifiers 
so that one can add cross-references within the document structure. Here 
is a sample xml file that shows what I mean:

<document>
   <bibitem xml:id="hagen2011">
     <author>Hans Hagen</author>
     <title>The Meaning of Life Is 42</title>
     <journal>The Rhetoric of Mathematics</journal>
     <date>2011</date>
   </bibitem>
   <bibitem xml:id="hagen2012">
     <author>Hans Hagen</author>
     <title>The New Meaning is Now 43</title>
     <journal>High Energy Metaphysics</journal>
     <date>2012</date>
   </bibitem>
   <text>
     <p>This has been successfully proven in papers by <bib
     ref="#hagen2011"/> and <bib ref="#hagen2012"/>.</p>
   </text>
</document>

[Note: the TEI guidelines add the hash character in the attribute value 
to such references, but after much googling, I'm still not sure if this 
is standard or necessary or bizarre.]

So: at the point of the reference (which may be empty, like here, or 
contain text), I want to refer back to the bibitems. The typesetting 
engine should then be instructed to pick up the information, so that 
this is, e.g., typeset as "This has been successfully proven in papers 
by Hans Hagen (2011) and Hans Hagen (2012)."

My idea: since the xml:id attributes must be unique across the document, 
it would be easiest to collect them into a lua table, with the xml:id as 
key, so their content could be accessed and typeset later. But 
unfortunately, I have no clue how to go about this... Could somebody 
provide a pointer?

Thanks for your interest, if you've read this far!

Thomas
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


             reply	other threads:[~2012-09-11 17:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-11 17:22 Thomas A. Schmitz [this message]
2012-09-11 18:18 ` Hans Hagen
2012-09-12  6:32   ` Thomas A. Schmitz

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=504F7345.6050309@uni-bonn.de \
    --to=thomas.schmitz@uni-bonn.de \
    --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).