From: Bruce Horrocks via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Bruce Horrocks <ntg@scorecrow.com>
Subject: Re: XML Namespaces and XML Setups
Date: Mon, 23 May 2022 21:14:54 +0100 [thread overview]
Message-ID: <2082AE8E-0195-4408-A32F-2B1C24D66B03@scorecrow.com> (raw)
In-Reply-To: <CAN8fp9UxA7s7H0W+0LBTW7_j5ww5W5vj2tEznqTGgWePP6ZA+g@mail.gmail.com>
Does this help?
\startxmlsetups xml:demo:base
\xmlsetsetup{#1}{tag}{xml:demo:tag}
\xmlsetsetup{#1}{o:tag}{xml:demo:otag} %% <---
\stopxmlsetups
\xmlregisterdocumentsetup{demo}{xml:demo:base}
\startxmlsetups xml:demo:tag
\xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:demo:otag %% <---
{\bf \xmlflush{#1}}
\stopxmlsetups
\starttext
\startbuffer[test]
<?xml version="1.0"?>
<root xmlns="NameSpaceA"
xmlns:o="NameSpaceO">
<tag>text</tag> <o:tag>text</o:tag>
</root>
\stopbuffer
\xmlprocessbuffer{demo}{test}{}
\stoptext
> On 23 May 2022, at 09:07, Duncan Hothersall via ntg-context <ntg-context@ntg.nl> wrote:
>
> I found this unanswered question on the list from November 2020 and find today that I have the same question. How can one handle elements with the same name but in different namespaces? How should the different \startxmlsetups commands be written?
>
> Thanks.
>
> Duncan
>
> On Mon, 16 Nov 2020 at 13:37, Christoph Reller <christoph.reller@gmail.com> wrote:
> Dear List,
>
> Consider the following MWE:
>
> \startxmlsetups xml:demo:base
> \xmlsetsetup{#1}{tag}{xml:demo:tag}
> \stopxmlsetups
> \xmlregisterdocumentsetup{demo}{xml:demo:base}
> \startxmlsetups xml:demo:tag
> %\doif{\xmlnamespace{#1}}{o}{NameSpaceO:}
> \xmlflush{#1}
> \stopxmlsetups
> \starttext
> \startbuffer[test]
> <?xml version="1.0"?>
> <root xmlns="NameSpaceA"
> xmlns:o="NameSpaceO">
> <tag>text</tag> <o:tag>text</o:tag>
> </root>
> \stopbuffer
> \xmlprocessbuffer{demo}{test}{}
> \stoptext
>
> My questions:
> - Is there a good way to have a separate XML setup for each XML namespace?
> - Alternatively, one has to do the distinction within the same XML setup. In this case, how do we get the complete namespace? (In this example: "NameSpaceA" and "NameSpaceO")
>
> Thanks in advance for your help!
>
> Cheers, Christoph
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
>
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
—
Bruce Horrocks
Hampshire, UK
___________________________________________________________________________________
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-05-23 20:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-16 13:31 Christoph Reller
2022-05-23 8:07 ` Duncan Hothersall via ntg-context
2022-05-23 20:14 ` Bruce Horrocks via ntg-context [this message]
2022-05-24 8:50 ` Duncan Hothersall via ntg-context
2022-05-24 15:40 ` Bruce Horrocks 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=2082AE8E-0195-4408-A32F-2B1C24D66B03@scorecrow.com \
--to=ntg-context@ntg.nl \
--cc=ntg@scorecrow.com \
/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).