Here's a fairly minimal example showing an issue, using ConTeXt LMTX.
Save the following as "main.tex":

% SOF
\startbuffer[document]
<body><img src="circle.svg"/></body>
\stopbuffer

\startbuffer[csvg]
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg";>
<g><circle cx="50" cy="50" r="20"/></g>
</svg>
\stopbuffer

\startxmlsetups xml:xhtml
  \xmlsetsetup{\xmldocument}{body|img}{xml:*}
\stopxmlsetups

\startxmlsetups xml:body
  \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:img
  \placefigure{}{\externalfigure[\xmlatt{#1}{src}][conversion=mp]}
  \placefigure{}{\externalfigure[circle.svg][conversion=mp]}
  \placefigure{}{\includesvgbuffer[csvg][conversion=mp]}
\stopxmlsetups

\xmlregistersetup{xml:xhtml}

\starttext
  \xmlprocessbuffer{xhtml}{document}{}

  \placefigure{}{\externalfigure[circle.svg][conversion=mp]}
  \placefigure{}{\externalfigure[diagram.svg][conversion=mp]}
\stoptext
% EOF

Save the contents of "\startbuffer[csvg]" to a file named
"circle.svg", to create a valid, external SVG file.

Copy "circle.svg" to a file named "diagram.svg" to create a second
valid, external SVG file.

Run: context main.tex

Expected

All the SVG images appear.

Actual

Figures 1, 2, and 4 show only the following text:

\includesvgfile[circle.svg]\resetbuffer[svg-circle-inclusion]

In contrast, consider the following document:

% SOF
\startbuffer[csvg]
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg";>
<g><circle cx="50" cy="50" r="20"/></g>
</svg>
\stopbuffer

\starttext
  \placefigure{}{\includesvgbuffer[csvg][conversion=mp]}
  \placefigure{}{\externalfigure[circle.svg][conversion=mp]}
  \placefigure{}{\externalfigure[diagram.svg][conversion=mp]}
\stoptext
% EOF

All the images appear as expected.

Any idea why using XML setups appears to affect the behaviour of
rendering SVG documents using MetaPost?

Thank you!
___________________________________________________________________________________
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
___________________________________________________________________________________

Reply via email to