A possibility is saving the data as text in a Lua-table. If you are not afraid to use some Lua, I can send my code for saving files and data for repeated use.

dr. Hans van der Meer


On 18 Sep 2020, at 15:36, Denis Maier <denis.maier.lists@mailbox.org> wrote:

Hi,

For typesetting XML I'm wondering how to best store text for later use:

I've tried using buffers, but this here doesn't work:

==================
\startxmlsetups xml:article-meta
    \setupdocument [
pub-year=\xmlfilter{#1}{/pub-date/year/command(xml:article-meta:pubdate:year)},
volume=\xmlfilter{#1}{/volume/command(xml:article-meta:volume)},
doi=\xmlfilter{#1}{/article-id[@pub-id-type='doi']/command(xml:article-meta:doi)},
elocation-id=\xmlfilter{#1}{/elocation-id/command(xml:article-meta:elocation-id)},
title=\xmlfilter{#1}{/title-group/article-title/command(xml:article-meta:title-group:article-title)},
        author={\AuthorList},
    ]
  \startbuffer[abstract]
      \xmlfilter{#1}{/abstract/command(xml:article-meta:abstract)}
  \stopbuffer
   \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:article-meta:abstract
    \xmlflush{#1}
\stopxmlsetups
===================

This here works:

==================
\startxmlsetups xml:article-meta
    \setupdocument [
pub-year=\xmlfilter{#1}{/pub-date/year/command(xml:article-meta:pubdate:year)},
volume=\xmlfilter{#1}{/volume/command(xml:article-meta:volume)},
doi=\xmlfilter{#1}{/article-id[@pub-id-type='doi']/command(xml:article-meta:doi)},
elocation-id=\xmlfilter{#1}{/elocation-id/command(xml:article-meta:elocation-id)},
title=\xmlfilter{#1}{/title-group/article-title/command(xml:article-meta:title-group:article-title)},
        author={\AuthorList},
abstract=\xmlfilter{#1}{/abstract/command(xml:article-meta:abstract)},
    ]
   \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:article-meta:abstract
    \xmlflush{#1}
\stopxmlsetups
===================

But has using a variable for the abstract any drawbacks? (The abstract might contain multiple paragraphs.)

Best,
Denis
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________