Hello,

My XML mapping rule for a floating figure looks (thanks to Hans' help) as
follows:

\defineXMLenvironment 
  [figure]
  [width=]
  [location=here]
  {
    \bgroup
    \defineXMLsave[caption]
    \defineXMLsave[graphic]
  }
  {
    \placefigure
      [\XMLpar{figure}{location}{}]
      [\XMLpar{figure}{label}{unknown}]
      {\XMLflush{caption}}
      {\externalfigure[\XMLflush{graphic}][width=\XMLpar{figure}{width}{}}]}
    \egroup
  }

I want to make it possible to call '\textwidth' from the XML code. '<figure
width="\textwidth">' does not work and does not make much sense when using
the XML with something else but ConTeXt, so I want to implement a mapping
of 'max' to '\textwidth'. I looked up some code Hans gave me for lists and
came up with the following:

\mapXMLvalue {figure:width} {max} {\textwidth}
\defineXMLenvironment 
  [figure]
  [width=]
  [location=here]
  {
    \bgroup
    \defineXMLsave[caption]
    \defineXMLsave[graphic]
  }
  {
    \placefigure
      [\XMLpar{figure}{location}{}]
      [\XMLpar{figure}{label}{unknown}]
      {\XMLflush{caption}}
      {\externalfigure[\XMLflush{graphic}][width=\XMLval{figure:width
{\XMLop{width}}{}]}
    \egroup
  }

This works great when saying '<figure width="max">', but I loose the
possibility of giving absolute values for 'width' - as in '<figure
width="10cm">'.
Any hints on how to get the 'max' option while retaining compatibility with
absolute values?

Thanks, Joh

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to