* bug when dealing with XML classes?
@ 2015-01-22 18:42 Pablo Rodriguez
2015-01-22 18:57 ` Hans Hagen
0 siblings, 1 reply; 3+ messages in thread
From: Pablo Rodriguez @ 2015-01-22 18:42 UTC (permalink / raw)
To: mailing list for ConTeXt users
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"
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.
I think this might be a bug in ConTeXt.
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: bug when dealing with XML classes?
2015-01-22 18:42 bug when dealing with XML classes? Pablo Rodriguez
@ 2015-01-22 18:57 ` Hans Hagen
2015-01-22 19:32 ` Pablo Rodriguez
0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2015-01-22 18:57 UTC (permalink / raw)
To: ntg-context
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
-----------------------------------------------------------------
___________________________________________________________________________________
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: bug when dealing with XML classes?
2015-01-22 18:57 ` Hans Hagen
@ 2015-01-22 19:32 ` Pablo Rodriguez
0 siblings, 0 replies; 3+ messages in thread
From: Pablo Rodriguez @ 2015-01-22 19:32 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 01/22/2015 07:57 PM, Hans Hagen wrote:
> On 1/22/2015 7:42 PM, Pablo Rodriguez wrote:
>>[...]
>> 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}{}
Many thanks for your fast reply, Hans.
I was totally wrong. It was my understanding the one that was buggy :-).
Many thanks for your help again,
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-22 19:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-22 18:42 bug when dealing with XML classes? Pablo Rodriguez
2015-01-22 18:57 ` Hans Hagen
2015-01-22 19:32 ` 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).