Happy New Year!

How would you implement a mechanism that takes arbitrary XHTML <meta> tags and produces document variables? Consider:

    <meta name="journal" content="Nature" />

After running XML setups, the following would write "Nature":

    \documentvariable{journal}

The tricky part is doing this without pre-defining them. Here's a short, self-contained example to help demonstrate:

\startbuffer[xdoc]
<html>
<head>
  <meta content="Milena Marić Einstein" name="author"/>
  <meta content="Annalen der Physik" name="journal"/>
</head>
<body>
</body>
</html>
\stopbuffer

\startxmlsetups xml:xhtml
  \xmlsetsetup{\xmldocument}{*}{-}
  \xmlsetsetup{\xmldocument}{html|body}{xml:*}
  \xmlsetsetup{\xmldocument}{head}{xml:meta}
\stopxmlsetups

\xmlregistersetup{xml:xhtml}

\startxmlsetups xml:html
% "author" is a special setup, not generalized \xmlfilter{#1}{/head/meta[@name='author']/command(xml:author)} % What goes here to make this dynamic? %\xmlfilter{#1}{/head/meta[@name='journal']/command(xml:journal)} \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:author \setupdocument[author={\xmlatt{#1}{content}}] \setupdocument[metadata:author={\xmlatt{#1}{content}}] \setupinteraction[author={\documentvariable{author}}] \stopxmlsetups % How can this be generalized? %\startxmlsetups xml:journal %\setupdocument[journal={\xmlatt{#1}{content}}] %\stopxmlsetups \startxmlsetups xml:body \startdocument Author: \documentvariable{author} \par Journal: \documentvariable{journal} \stopdocument \stopxmlsetups \xmlprocessbuffer{main}{xdoc}{}

Thank you!