Hi

I managed to build a small example…

you need to apply setups so here we just load at the tex end

Hans

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
\startbuffer[test]
<document>
    <include href="test.xml"/>
</document>
\stopbuffer

\startxmlsetups xml:testsetups
  \xmlinclude{#1}{include}{}
  \xmlsetsetup{#1}{*}{-}
  \xmlsetsetup{#1}{document|chapter|chaptertitle|note|emph|p}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:testsetups}

\startxmlsetups xml:document
        \xmlfunction {#1} {document}
\stopxmlsetups

\startxmlsetups xml:emph
    {\em \xmlflush {#1}}
\stopxmlsetups

\startxmlsetups xml:note:typeset
    {\bf \xmlflush {#1}}
\stopxmlsetups

\startluacode
function xml.functions.document (t)
    for e in xml.collected (t, "chapter") do
        local ch_title = xml.text (e, "/chaptertitle")
        context.startchapter { title = ch_title }
        for note in xml.collected (e, "/**/note") do
            lxml.command (note, "/", "xml:note:typeset")
        end
        context.stopchapter ()
    end
end
\stopluacode

\setupbodyfont [times,12pt]

\starttext
        \xmlprocessbuffer{main}{test}{}
\stoptext
<chapter>
	<chaptertitle>Chapter 1</chaptertitle>
	<p>
        Text <emph>italics</emph>.
        <note xml:id="note_1">This is <emph>note</emph> 1.</note>
        More <bold>italics</bold>.
        <note xml:id="note_2">This is <emph>note</emph> 2.</note>
    </p>
</chapter>
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to