ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* XML/MathML namespace handling bug
@ 2021-03-20 21:52 Hugo Landau
  2021-03-21  2:06 ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Hugo Landau @ 2021-03-20 21:52 UTC (permalink / raw)
  To: ntg-context

Thanks for ConTeXt, it is an amazing system.

The following test case demonstrates the bug.

  \usemodule[mathml]
  \starttext
  \xmlprocessdata{}{
  <?xml version="1.0" encoding="utf-8"?>
  <foo xmlns="http://www.example.com/ns/foo" xmlns:m="http://www.w3.org/1998/Math/MathML">
  <m:math version="2.0">
    <m:apply><m:union/><m:ci>a</m:ci><m:ci>b</m:ci></m:apply>
  </m:math>
  <m:math version="2.0">
    <m:apply><m:selector/><m:ci>a</m:ci><m:ci>b</m:ci></m:apply>
  </m:math>
  </foo>
  }{}
  \stoptext

No output is produced. This has been verified with live.contextgarden.net.

In order for output to be produced, <m:union/> must be changed to <union> and
<m:selector/> must be changed to <selector/>, but these are in the wrong
namespace in this context. In other words, this bug applies to the keyword
element in an apply element. 

Hugo Landau
___________________________________________________________________________________
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] 4+ messages in thread

* Re: XML/MathML namespace handling bug
  2021-03-20 21:52 XML/MathML namespace handling bug Hugo Landau
@ 2021-03-21  2:06 ` Hans Hagen
  2021-03-26  5:02   ` Hugo Landau
  0 siblings, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2021-03-21  2:06 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Hugo Landau

On 3/20/2021 10:52 PM, Hugo Landau wrote:
> Thanks for ConTeXt, it is an amazing system.
> 
> The following test case demonstrates the bug.
> 
>    \usemodule[mathml]
>    \starttext
>    \xmlprocessdata{}{
>    <?xml version="1.0" encoding="utf-8"?>
>    <foo xmlns="http://www.example.com/ns/foo" xmlns:m="http://www.w3.org/1998/Math/MathML">
>    <m:math version="2.0">
>      <m:apply><m:union/><m:ci>a</m:ci><m:ci>b</m:ci></m:apply>
>    </m:math>
>    <m:math version="2.0">
>      <m:apply><m:selector/><m:ci>a</m:ci><m:ci>b</m:ci></m:apply>
>    </m:math>
>    </foo>
>    }{}
>    \stoptext
> 
> No output is produced. This has been verified with live.contextgarden.net.
> 
> In order for output to be produced, <m:union/> must be changed to <union> and
> <m:selector/> must be changed to <selector/>, but these are in the wrong
> namespace in this context. In other words, this bug applies to the keyword
> element in an apply element.
in x-math.mkiv search for

    \startxmlsetups mml:apply

and replace this bit:

             \edef\mmlapplyaction{\xmlfilter{#1}{/*/tag()}}
             \doifelsesetups {mml:apply:mml:\mmlapplyaction} {
                 \xmlsetup{#1}{mml:apply:mml:\mmlapplyaction}
              } {
                 \xmlsetup{#1}{mml:\mmlapplyaction}
              }

(btw, isn't content mathml more fun than presentation mathml?)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: XML/MathML namespace handling bug
  2021-03-21  2:06 ` Hans Hagen
@ 2021-03-26  5:02   ` Hugo Landau
  2021-03-26  8:16     ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Hugo Landau @ 2021-03-26  5:02 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users

> in x-math.mkiv search for
> 
>    \startxmlsetups mml:apply
> 
> and replace this bit:
> 
>             \edef\mmlapplyaction{\xmlfilter{#1}{/*/tag()}}
>             \doifelsesetups {mml:apply:mml:\mmlapplyaction} {
>                 \xmlsetup{#1}{mml:apply:mml:\mmlapplyaction}
>              } {
>                 \xmlsetup{#1}{mml:\mmlapplyaction}
>              }
> 
> (btw, isn't content mathml more fun than presentation mathml?)
Works nicely. For <eq/> I also had to change this part from name() to
tag():

\startxmlsetups mml:relation
    \edef\mmlapplyaction{\xmlfilter{#1}{/*/tag()}}
    \MMLcreset \xmlsetup{#1}{mml:relation:\xmlattdef{#1}{align}{\MMLrelationalign}}
\stopxmlsetups
___________________________________________________________________________________
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] 4+ messages in thread

* Re: XML/MathML namespace handling bug
  2021-03-26  5:02   ` Hugo Landau
@ 2021-03-26  8:16     ` Hans Hagen
  0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2021-03-26  8:16 UTC (permalink / raw)
  To: Hugo Landau; +Cc: mailing list for ConTeXt users

On 3/26/2021 6:02 AM, Hugo Landau wrote:
>> in x-math.mkiv search for
>>
>>     \startxmlsetups mml:apply
>>
>> and replace this bit:
>>
>>              \edef\mmlapplyaction{\xmlfilter{#1}{/*/tag()}}
>>              \doifelsesetups {mml:apply:mml:\mmlapplyaction} {
>>                  \xmlsetup{#1}{mml:apply:mml:\mmlapplyaction}
>>               } {
>>                  \xmlsetup{#1}{mml:\mmlapplyaction}
>>               }
>>
>> (btw, isn't content mathml more fun than presentation mathml?)
> Works nicely. For <eq/> I also had to change this part from name() to
> tag():
> 
> \startxmlsetups mml:relation
>      \edef\mmlapplyaction{\xmlfilter{#1}{/*/tag()}}
>      \MMLcreset \xmlsetup{#1}{mml:relation:\xmlattdef{#1}{align}{\MMLrelationalign}}
> \stopxmlsetups
can you also check

\startxmlsetups mml:apply:inverse
     \settrue\xmlinversefunction
     \xmlsetup{#1}{mml:\xmlfilter{#1}{/mml:apply/*[2]/tag()}}
\stopxmlsetups


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2021-03-26  8:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-20 21:52 XML/MathML namespace handling bug Hugo Landau
2021-03-21  2:06 ` Hans Hagen
2021-03-26  5:02   ` Hugo Landau
2021-03-26  8:16     ` Hans Hagen

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).