ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Anand Raj <anand.seed@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Html to pdf using pragma script
Date: Tue, 21 Dec 2010 17:42:23 +0800	[thread overview]
Message-ID: <AANLkTim_uVgOhywRC5NEhG3ddBQX4oh7jr5Jt0VjjvGv@mail.gmail.com> (raw)
In-Reply-To: <AANLkTi=aDrOswd3c0WwpyENJEZ63=xFROOOPEWbpec4q@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 3822 bytes --]

Hi,

I have input xml file say *input.xml*

<?xml version="1.0" encoding="UTF-8"?>
<document>
    <div class='question'>
        <div>
            Solve by factoring:
            <br/><br/>
            *<am>
<math title="3/12"><mstyle displaystyle="true" fontfamily="serif"><mfrac><mn
>3</mn><mn>12</mn></mfrac></mstyle></math>
           </am>*
            <br/><br/>
            Give <i>either</i> of the two solutions.
        </div>
    </div>
</document>

Then I have the tex file to generate the pdf say *generate.tex*

\usemodule[mathml]

\setupbodyfont[palatino]

\startxmlsetups xml:testsetups
    \xmlsetsetup{test} {document|b|p|i|br|am}   {xml:*}
    \xmlsetsetup{test} {p[@class='tips']}       {xml:tips}
    \xmlsetsetup{test} {br[tag(1)='br']}        {xml:brbr}
    \xmlsetsetup{test} {div}                    {xml:div}
    \xmlsetsetup{test} {input}                  {xml:input}
    \xmlsetsetup{test} {input[@type='text']}    {xml:inputtext}
    \xmlsetsetup{test} {script|span}            {xml:skip}
    \xmlsetsetup{test} {div[@class='question']} {xml:question}
    \xmlsetsetup{test} {div[@class='review']}   {xml:review}
\stopxmlsetups

\xmlregistersetup{xml:testsetups}

\startxmlsetups xml:document
    \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:skip
    \removeunwantedspaces\ignorespaces
\stopxmlsetups

\startxmlsetups xml:input
\stopxmlsetups

\startxmlsetups xml:inputtext
    \blank
%     \dontleavehmode\strut\blackrule[height=1pt,depth=0pt,width=\textwidth]
    \dontleavehmode\underbar{\strut\char0\hskip\textwidth\strut}
    \blank
\stopxmlsetups

\startxmlsetups xml:div
    \blank
    \xmlflush{#1}
    \blank
\stopxmlsetups

\newcount\QuestionCounter

\startxmlsetups xml:question
    \blank
    \global\advance\QuestionCounter\plusone
    \margintitle{\the\QuestionCounter}
    \xmlflush{#1}
    \blank
\stopxmlsetups

\startxmlsetups xml:review
%     \blank
%     \xmlflush{#1}
%     \blank
\stopxmlsetups

*\startxmlsetups xml:am
   \xmlprocessdata{}{
<math xmlns='http://www.w3.org/1998/Math/MathML'>
 <mrow>
  <msup> <mi>x</mi><mn>2</mn> </msup>
  <mo>+</mo>
  <mrow>
    <mn>4</mn><mi>x</mi>
  </mrow>
  <mo>+</mo>
  <mn>4</mn>
 </mrow>
</math>
}{}
\stopxmlsetups
*
\startxmlsetups xml:br
    \par
\stopxmlsetups

\startxmlsetups xml:p
    \par
\stopxmlsetups

\startxmlsetups xml:tips
    \blank
    \bgroup\bf Tips: \egroup\xmlflush{#1}
    \blank
\stopxmlsetups

\startxmlsetups xml:brbr
    \blank
\stopxmlsetups

\startxmlsetups xml:i
    \bgroup\it\xmlflush{#1}\egroup
\stopxmlsetups

\startxmlsetups xml:b
    \bgroup\it\xmlflush{#1}\egroup
\stopxmlsetups

\starttext
    \xmlprocessfile{test}{whatever-011.xml}{}
\stoptext

\stop


now, I need your help to use *<am></am>* value from input.xml and use it in
*\startxmlsetups xml:am* *\xmlprocessdata*as parameter.

Thanks
Anand




On Tue, Dec 21, 2010 at 5:03 PM, luigi scarso <luigi.scarso@gmail.com>wrote:

> On Tue, Dec 21, 2010 at 10:01 AM, Hans Hagen <pragma@wxs.nl> wrote:
> > On 21-12-2010 8:04, Anand Raj wrote:
> >>
> >> Hi,
> >>
> >> how to map svg tags from xml and tex file.?
> >
> > Dump the svg blob in a file (say image-1.svg) and then use
> > \extenalfigure[image-1.svg] to place it. Conversion to pdf will happen
> > automatically then
> if you have inkscape installed
>
>
> --
> luigi
>
> ___________________________________________________________________________________
> 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 #1.2: Type: text/html, Size: 6113 bytes --]

[-- Attachment #2: Type: text/plain, Size: 486 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
___________________________________________________________________________________

      reply	other threads:[~2010-12-21  9:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-20  8:48 Anand Raj
2010-12-20  9:18 ` Wolfgang Schuster
2010-12-21  2:12   ` Anand Raj
2010-12-21  8:13     ` Henning Hraban Ramm
2010-12-21  8:34       ` Thomas Schmitz
2010-12-21  7:04 ` Anand Raj
2010-12-21  9:01   ` Hans Hagen
2010-12-21  9:03     ` luigi scarso
2010-12-21  9:42       ` Anand Raj [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTim_uVgOhywRC5NEhG3ddBQX4oh7jr5Jt0VjjvGv@mail.gmail.com \
    --to=anand.seed@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).