ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* \xmldoifelseempty
@ 2018-03-18 12:23 Pablo Rodriguez
  2018-03-18 18:37 ` \xmldoifelseempty survoje
  0 siblings, 1 reply; 6+ messages in thread
From: Pablo Rodriguez @ 2018-03-18 12:23 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear list,

I have the following sample:

  \startbuffer[demo]
  <doc>
    <pre class="sourceCode tex typeset-fullwidth">
      <code class="sourceCode latex">
        \setupexternalfigures[location=default]
        \starttext
        \startTEXpage[offset=1ex]
        Full–width:

        \externalfigure[cow]
        \stopTEXpage
        \stoptext
      </code>
    </pre>
    <pre class="sourceCode tex typeset">
        <code class="sourceCode latex">
        \setupexternalfigures[location=default]
        \starttext
        \startTEXpage[offset=1ex]
        Half–width:

        \externalfigure[cow]
        \stopTEXpage
        \stoptext
      </code>
    </pre>
  </doc>
  \stopbuffer

  \startxmlsetups xml:initialize
     \xmlsetsetup{#1}{doc}{xml:*}
     \xmlsetsetup{\xmldocument}
        {pre[contains(@class,'typeset')]/code}
        {xml:pre:code}
  \stopxmlsetups

  \xmlregistersetup{xml:initialize}

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

  \startxmlsetups xml:pre:code
    \xmlinfo{#1}
    \xmltobuffertextonly{#1}{.}{whereever}
    \xmldoifelseempty{#1}{../pre[contains(@class,'fullwidth')]}

{\startalign[center]\dontleavehmode\typesetbuffer[whereever][width=.5\textwidth]\stopalign}

{\startalign[center]\dontleavehmode\typesetbuffer[whereever][width=\textwidth]\stopalign}
  \stopxmlsetups

  \starttext
     \xmlprocessbuffer{main}{demo}{}
  \stoptext

How can I get in xml:pre:code that the presence or absence of
{../pre[contains(@class,'fullwidth')]} may trigger a conditional?

From what I understand from xml-mkiv.pdf, \xmldoifelseempty would be the
right command, but I cannot make it work.

Many thanks for your help,

Pablo
-- 
http://www.ousia.tk
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-03-18 22:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-18 12:23 \xmldoifelseempty Pablo Rodriguez
2018-03-18 18:37 ` \xmldoifelseempty survoje
2018-03-18 19:22   ` \xmldoifelseempty Pablo Rodriguez
2018-03-18 19:32   ` \xmldoifelseempty Wolfgang Schuster
2018-03-18 22:21     ` \completindex in \setuparranging Gerard
2018-03-18 22:50       ` Pablo Rodriguez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).