On 1/22/2015 7:42 PM, Pablo Rodriguez wrote:
Hans,
I have the following sample:
\setupbodyfont[30pt] \startbuffer[demo] <doc> <h1>This is my title</h1>
<div class="section" class="level1" class="hidden"> <h1>This title is hidden</h1> </div>
<div class="section level1 hidden"> <h1>This title is not hidden</h1>
<p>Text</p> </div> </doc> \stopbuffer
\starttext
\startxmlsetups xml:initialize \xmlsetsetup{#1}{div}{xml:div} \xmlsetsetup{#1}{h1}{xml:h1} \xmlsetsetup{\xmldocument}{[@id='epigraph']}{xml:epigraph} \xmlsetsetup{#1}{[@class='hidden']/h1}{} \stopxmlsetups
\xmlregistersetup{xml:initialize}
\startxmlsetups xml:div \xmlflush{#1} \stopxmlsetups
\startxmlsetups xml:h1 \section{\xmlflush{#1}} \stopxmlsetups
\xmlprocessbuffer{main}{demo}{} \stoptext
ConTeXt MkIV is not able to understand
class="section level1 hidden"
as
class="section" class="level1" class="hidden"
It has nothing to do with understanding: successive attributes with the same name will overload a previous one. You can try this: \xmlsetsetup{#1}{[contains(@class,'hidden')]/h1}{}
and the second attribution is invalid XML (according to the W3C Validator [http://validator.w3.org/] and xmlvalidation.com): class should be only specified once.
it says: the markup validity of Web documents in HTML, XHTML, SMIL, MathML, etc.
I think this might be a bug in ConTeXt.
we parse xml, and not html (some evolving dialect) ... in fact i think that the last class will win so that boils down to using only one
Many thanks for your help,
Pablo
-- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------