From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Hans Hagen <j.hagen@xs4all.nl>
Subject: Re: redefining xmlsetups inside a XML document
Date: Thu, 10 Mar 2022 17:52:20 +0100 [thread overview]
Message-ID: <96fc7edb-8a9b-4ffe-3e10-fadd15ed130a@xs4all.nl> (raw)
In-Reply-To: <12036b6d-32d2-c2bc-7c19-1953d0bc097a@fastwebnet.it>
On 3/10/2022 4:59 PM, mf via ntg-context wrote:
> Hello,
> I'm trying to add new templates (xmlsetups) from the XML document itself.
>
> See the attached MWE.
>
> - the XML document is a simple XHTML file
>
> - in the "head" element there's a "script" element with the "type"
> attribute set to "text/vnd.context", whose contents are then passed to
> \xmlcontext
>
> - the "body" element has a "data-xmlsetups" attribute whose value should
> tell which xmlsetups is to be applied on the body contents (it's defined
> in the "script" element above)
>
> If it worked, the resulting PDF should show the body element, followed
> by a "Hello world!" paragraph written in red.
> But it does not work, because there's something I'm missing in the
> redefinition and application of xmlsetups.
>
> To try the MWE, type:
>
> context --environment=nested-xmlsetup.tex --forcexml nested-xmlsetup.xhtml
<script type="text/vnd.context">
\startxmlsetups myHtml
\xmlsetsetup{#1}{p}{myHtml:p}
% you're missing this
\xmlsetup{#1}{xml:process}
% which is
% \xmlregistereddocumentsetups{#1}{#1}
% \xmlmain{#1}
\stopxmlsetups
\startxmlsetups myHtml:p
\dontleavehmode\red\xmlflush{#1}\par
\stopxmlsetups
</script>
-----------------------------------------------------------------
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
___________________________________________________________________________________
next prev parent reply other threads:[~2022-03-10 16:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-10 15:59 mf via ntg-context
2022-03-10 16:52 ` Hans Hagen via ntg-context [this message]
2022-03-22 14:23 ` mf via ntg-context
2022-03-22 16:07 ` mf via ntg-context
2022-03-24 13:34 ` embedding tex and lua code in <script> elements inside HTML - was: " mf via ntg-context
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=96fc7edb-8a9b-4ffe-3e10-fadd15ed130a@xs4all.nl \
--to=ntg-context@ntg.nl \
--cc=j.hagen@xs4all.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).