ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* MkIV XML and |c|c|c|
@ 2014-01-19 10:53 Kate F
  2014-01-20  8:28 ` H. van der Meer
  2014-01-20 17:46 ` Hans Hagen
  0 siblings, 2 replies; 3+ messages in thread
From: Kate F @ 2014-01-19 10:53 UTC (permalink / raw)
  To: ntg-context

Hi,

I'm trying to glue MkIV XML handling to ConTeXt's tabulation. My
markup has a HTML-style table model, with an arbitary number of <col>
elements.

My problem is to produce the |c|c|c|c| format based on the number of
<col> elements I have, rather than hardcoding a specific number of
columns.

I thought I could do something like this, but unfortunately the string
produced by \xmlconcat{#1}{col}{\|} seems to be ignored:

    % in practice this would produce various alignments, not just "c"
    \startxmlsetups xml:col
        c
    \stopxmlsetups

    \startxmlsetups xml:table
        \starttabulate[\|\xmlconcat{#1}{col}{\|}\|]
        \xmlall{#1}{thead|tbody}
        \stoptabulate
    \stopxmlsetups

Whereas this works fine, as I'd expect: \starttabulate[|c|c|c|c|]

(I'm also confused about the escaping for \| there. I guess the [] is
a special environment, with | being given a different catcode,
perhaps?)

Is there a way to do this, with the number of columns and their
alignment generated from the input XML?

Thanks,

-- 
Kate
___________________________________________________________________________________
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: MkIV XML and |c|c|c|
  2014-01-19 10:53 MkIV XML and |c|c|c| Kate F
@ 2014-01-20  8:28 ` H. van der Meer
  2014-01-20 17:46 ` Hans Hagen
  1 sibling, 0 replies; 3+ messages in thread
From: H. van der Meer @ 2014-01-20  8:28 UTC (permalink / raw)
  To: NTG ConTeXt

[-- Attachment #1: Type: text/plain, Size: 164 bytes --]

I have done some things with html-xml. Perhaps looking into the following ConTeXt code will help you to find how to do things. Hope it helps.

Hans van der Meer

[-- Attachment #2: hvdm-xml.tex.zip --]
[-- Type: application/zip, Size: 9162 bytes --]

[-- Attachment #3: Type: text/plain, Size: 1726 bytes --]




On 19 jan. 2014, at 11:53, Kate F <kate@elide.org> wrote:

> Hi,
> 
> I'm trying to glue MkIV XML handling to ConTeXt's tabulation. My
> markup has a HTML-style table model, with an arbitary number of <col>
> elements.
> 
> My problem is to produce the |c|c|c|c| format based on the number of
> <col> elements I have, rather than hardcoding a specific number of
> columns.
> 
> I thought I could do something like this, but unfortunately the string
> produced by \xmlconcat{#1}{col}{\|} seems to be ignored:
> 
>    % in practice this would produce various alignments, not just "c"
>    \startxmlsetups xml:col
>        c
>    \stopxmlsetups
> 
>    \startxmlsetups xml:table
>        \starttabulate[\|\xmlconcat{#1}{col}{\|}\|]
>        \xmlall{#1}{thead|tbody}
>        \stoptabulate
>    \stopxmlsetups
> 
> Whereas this works fine, as I'd expect: \starttabulate[|c|c|c|c|]
> 
> (I'm also confused about the escaping for \| there. I guess the [] is
> a special environment, with | being given a different catcode,
> perhaps?)
> 
> Is there a way to do this, with the number of columns and their
> alignment generated from the input XML?
> 
> Thanks,
> 
> -- 
> Kate
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________


[-- Attachment #4: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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: MkIV XML and |c|c|c|
  2014-01-19 10:53 MkIV XML and |c|c|c| Kate F
  2014-01-20  8:28 ` H. van der Meer
@ 2014-01-20 17:46 ` Hans Hagen
  1 sibling, 0 replies; 3+ messages in thread
From: Hans Hagen @ 2014-01-20 17:46 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 1/19/2014 11:53 AM, Kate F wrote:
> Hi,
>
> I'm trying to glue MkIV XML handling to ConTeXt's tabulation. My
> markup has a HTML-style table model, with an arbitary number of <col>
> elements.
>
> My problem is to produce the |c|c|c|c| format based on the number of
> <col> elements I have, rather than hardcoding a specific number of
> columns.
>
> I thought I could do something like this, but unfortunately the string
> produced by \xmlconcat{#1}{col}{\|} seems to be ignored:
>
>      % in practice this would produce various alignments, not just "c"
>      \startxmlsetups xml:col
>          c
>      \stopxmlsetups
>
>      \startxmlsetups xml:table
>          \starttabulate[\|\xmlconcat{#1}{col}{\|}\|]
>          \xmlall{#1}{thead|tbody}
>          \stoptabulate
>      \stopxmlsetups
>
> Whereas this works fine, as I'd expect: \starttabulate[|c|c|c|c|]
>
> (I'm also confused about the escaping for \| there. I guess the [] is
> a special environment, with | being given a different catcode,
> perhaps?)
>
> Is there a way to do this, with the number of columns and their
> alignment generated from the input XML?

\usmeodule[cals]

also see the test suite mkiv/xml/tables* etc

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

end of thread, other threads:[~2014-01-20 17:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-19 10:53 MkIV XML and |c|c|c| Kate F
2014-01-20  8:28 ` H. van der Meer
2014-01-20 17:46 ` 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).