[NTG-context] bug when dealing with XML classes?

2015-01-22 Thread Pablo Rodriguez
Hans,

I have the following sample:

\setupbodyfont[30pt]
\startbuffer[demo]
doc
h1This is my title/h1

div class=section class=level1 class=hidden
h1This title is hidden/h1
/div

div class=section level1 hidden
h1This title is not hidden/h1

pText/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
___

Re: [NTG-context] bug when dealing with XML classes?

2015-01-22 Thread Hans Hagen

On 1/22/2015 7:42 PM, Pablo Rodriguez wrote:

Hans,

I have the following sample:

\setupbodyfont[30pt]
\startbuffer[demo]
doc
 h1This is my title/h1

 div class=section class=level1 class=hidden
 h1This title is hidden/h1
 /div

 div class=section level1 hidden
 h1This title is not hidden/h1

 pText/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
___

Re: [NTG-context] bug when dealing with XML classes?

2015-01-22 Thread Pablo Rodriguez
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
___