ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* XML: mapping definiton on the fly?
@ 2008-02-14  9:04 Johannes Graumann
  2008-02-15 20:05 ` Johannes Graumann
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Graumann @ 2008-02-14  9:04 UTC (permalink / raw)
  To: ntg-context

Dear XML-processing inclined,

I was wondering whether with MarkV it is possible to parse an XML file that
contains style definitions as well as there usage and create context
mappings for them on the fly. In the example fragment below this would
mean:
- scan the file until hitting the "<office:automatic-styles>" tag
- analyze the style definition, find it to be
        of family text
        of name T1
        requiring bold fonts
- construct a context/XML mapping along the lines of
    \startxmlsetups T1
      \bf{\xmlflush{#1}}
    \stopxmlsetups
- keep on scanning, when hitting the style invocation: use the dynamically
generated mapping.

Please excuse the hobbyists nomenclature. Thank you for your time and
insight,

Joh


<?xml version="1.0" encoding="UTF-8"?>
...
<office:automatic-styles>
  <style:style 
    style:name="T1" 
    style:family="text"
  >
    <style:text-properties 
      fo:font-weight="bold" 
      style:font-weight-asian="bold" 
      style:font-weight-complex="bold"
    />
  </style:style>
</office:automatic-styles>
<office:body>
  <office:text>
  ...
    <text:p 
      text:style-name="Standard"
    >
      Dies <text:span text:style-name="T1">ist</text:span> ein 
      Text.
    </text:p>
  </office:text>
</office:body>
...

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: XML: mapping definiton on the fly?
  2008-02-14  9:04 XML: mapping definiton on the fly? Johannes Graumann
@ 2008-02-15 20:05 ` Johannes Graumann
  2008-02-15 20:47   ` Hans Hagen
  2008-02-15 20:47   ` Hans Hagen
  0 siblings, 2 replies; 5+ messages in thread
From: Johannes Graumann @ 2008-02-15 20:05 UTC (permalink / raw)
  To: ntg-context

Hans,

Can you drop any hints as to whether this is even possible and whether
there's something exemplary around I may meditate about?

Thanks, Joh

Johannes Graumann wrote:

> Dear XML-processing inclined,
> 
> I was wondering whether with MarkV it is possible to parse an XML file
> that contains style definitions as well as there usage and create context
> mappings for them on the fly. In the example fragment below this would
> mean:
> - scan the file until hitting the "<office:automatic-styles>" tag
> - analyze the style definition, find it to be
>         of family text
>         of name T1
>         requiring bold fonts
> - construct a context/XML mapping along the lines of
>     \startxmlsetups T1
>       \bf{\xmlflush{#1}}
>     \stopxmlsetups
> - keep on scanning, when hitting the style invocation: use the dynamically
> generated mapping.
> 
> Please excuse the hobbyists nomenclature. Thank you for your time and
> insight,
> 
> Joh
> 
> 
> <?xml version="1.0" encoding="UTF-8"?>
> ...
> <office:automatic-styles>
>   <style:style
>     style:name="T1"
>     style:family="text"
>   >
>     <style:text-properties
>       fo:font-weight="bold"
>       style:font-weight-asian="bold"
>       style:font-weight-complex="bold"
>     />
>   </style:style>
> </office:automatic-styles>
> <office:body>
>   <office:text>
>   ...
>     <text:p
>       text:style-name="Standard"
>     >
>       Dies <text:span text:style-name="T1">ist</text:span> ein
>       Text.
>     </text:p>
>   </office:text>
> </office:body>
> ...
> 
>
___________________________________________________________________________________
> 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  : https://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
>
___________________________________________________________________________________


___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: XML: mapping definiton on the fly?
  2008-02-15 20:05 ` Johannes Graumann
@ 2008-02-15 20:47   ` Hans Hagen
  2008-02-15 21:45     ` Johannes Graumann
  2008-02-15 20:47   ` Hans Hagen
  1 sibling, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2008-02-15 20:47 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Johannes Graumann wrote:
> Hans,
> 
> Can you drop any hints as to whether this is even possible and whether
> there's something exemplary around I may meditate about?

this kind of questions always puts me in "need to think about it" mode 
which may take some time

anyhow, one solution is ...

\startluacode
   for e, d, t in xml.elements(lxml.id("#1")) do
	tex.sprint(...)	
   end
\stopluacode

of course ... untested

for nicer solutions i need more time



-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: XML: mapping definiton on the fly?
  2008-02-15 20:05 ` Johannes Graumann
  2008-02-15 20:47   ` Hans Hagen
@ 2008-02-15 20:47   ` Hans Hagen
  1 sibling, 0 replies; 5+ messages in thread
From: Hans Hagen @ 2008-02-15 20:47 UTC (permalink / raw)
  To: mailing list for ConTeXt users

btw, see x-*.mkiv for examples

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: XML: mapping definiton on the fly?
  2008-02-15 20:47   ` Hans Hagen
@ 2008-02-15 21:45     ` Johannes Graumann
  0 siblings, 0 replies; 5+ messages in thread
From: Johannes Graumann @ 2008-02-15 21:45 UTC (permalink / raw)
  To: ntg-context

Hans Hagen wrote:

> Johannes Graumann wrote:
>> Hans,
>> 
>> Can you drop any hints as to whether this is even possible and whether
>> there's something exemplary around I may meditate about?
> 
> this kind of questions always puts me in "need to think about it" mode
> which may take some time
> 
> anyhow, one solution is ...
> 
> \startluacode
>    for e, d, t in xml.elements(lxml.id("#1")) do
> tex.sprint(...)
>    end
> \stopluacode
> 
> of course ... untested
> 
> for nicer solutions i need more time
Take all the time you need ... just let me know when the right time comes
for some gentle prodding ... ;0)
I'll go meditate over your hints for a while in the meantime ...

Thank you for the tools!

Joh

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2008-02-15 21:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-14  9:04 XML: mapping definiton on the fly? Johannes Graumann
2008-02-15 20:05 ` Johannes Graumann
2008-02-15 20:47   ` Hans Hagen
2008-02-15 21:45     ` Johannes Graumann
2008-02-15 20:47   ` 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).