* [NTG-context] Another XML question
@ 2026-03-01 14:05 Jairo A. del Rio
2026-03-01 14:24 ` [NTG-context] " Denis Maier via ntg-context
2026-03-01 16:46 ` Pablo Rodriguez via ntg-context
0 siblings, 2 replies; 9+ messages in thread
From: Jairo A. del Rio @ 2026-03-01 14:05 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 979 bytes --]
Hi, list. I want to get some attributes from <meta> nodes in a document,
but I don't get results as expected. MWE:
\starttext
\startbuffer[test]
<document>
<title>A title</title>
<meta content="Masoud Pezeshkian" name="name"></meta>
<meta content="Iran" name="country"></meta>
<meta content="surgeon" name="profession"></meta>
</document>
\stopbuffer
\startxmlsetups xml:document
\xmlattribute{#1}{/meta[name=country]}{content}
\xmlattribute{#1}{/meta[name=name]}{content}
\xmlattribute{#1}{/meta[name=profession]}{content}
\stopxmlsetups
\startxmlsetups xml:mysetups
\xmlsetsetup{\xmldocument}{*}{-}
\xmlsetsetup{#1}{document}{xml:*}
\stopxmlsetups
\xmlregistersetup{xml:mysetups}
\xmlprocessbuffer{main}{test}{}
\stoptext
I expected something like "IranMasoudPezeshkiansurgeon", but the "content"
attribute with name="name" repeats thrice. I tried with other cases and I
have the same result: the first result repeats. Any ideas on what's
happening? Regards
Jairo
[-- Attachment #1.2: Type: text/html, Size: 1292 bytes --]
[-- Attachment #2: Type: text/plain, Size: 511 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* [NTG-context] Re: Another XML question
2026-03-01 14:05 [NTG-context] Another XML question Jairo A. del Rio
@ 2026-03-01 14:24 ` Denis Maier via ntg-context
2026-03-01 16:46 ` Pablo Rodriguez via ntg-context
1 sibling, 0 replies; 9+ messages in thread
From: Denis Maier via ntg-context @ 2026-03-01 14:24 UTC (permalink / raw)
To: mailing list for ConTeXt users, Jairo A. del Rio; +Cc: Denis Maier
[-- Attachment #1: Type: text/html, Size: 2533 bytes --]
[-- Attachment #2: Type: text/plain, Size: 511 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* [NTG-context] Re: Another XML question
2026-03-01 14:05 [NTG-context] Another XML question Jairo A. del Rio
2026-03-01 14:24 ` [NTG-context] " Denis Maier via ntg-context
@ 2026-03-01 16:46 ` Pablo Rodriguez via ntg-context
2026-03-04 2:58 ` Jairo A. del Rio
1 sibling, 1 reply; 9+ messages in thread
From: Pablo Rodriguez via ntg-context @ 2026-03-01 16:46 UTC (permalink / raw)
To: ntg-context; +Cc: Pablo Rodriguez
On 3/1/26 15:05, Jairo A. del Rio wrote:
> […]
> I expected something like "IranMasoudPezeshkiansurgeon", but the
> "content" attribute with name="name" repeats thrice. I tried with other
> cases and I have the same result: the first result repeats. Any ideas on
> what's happening? Regards
Hi Jairo,
it’s in the details, lpaths expect this syntax:
element[@attribute='value']
This is actually indepedent from `\xmlattribute`, but this is part of
the lpath/xpath selection (as already mentioned by Denis).
To get something like "Name Value: profession (country)", your relevant
code should read:
\startxmlsetups xml:document
\xmlattribute{#1}{meta[@name='name']}{content}:\
\xmlattribute{#1}{meta[@name='profession']}{content}\
(\xmlattribute{#1}{meta[@name='country']}{content})
\stopxmlsetups
I hope it helps,
Pablo
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* [NTG-context] Re: Another XML question
2026-03-01 16:46 ` Pablo Rodriguez via ntg-context
@ 2026-03-04 2:58 ` Jairo A. del Rio
2026-03-04 18:49 ` Pablo Rodriguez via ntg-context
0 siblings, 1 reply; 9+ messages in thread
From: Jairo A. del Rio @ 2026-03-04 2:58 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 1810 bytes --]
Thank you very much, Pablo! Sorry for the late answer. Since examples in
the manual weren't exactly easy to understand, I didn't realize I needed
quotes for attribute strings. Again, thanks for the remark and the example
El dom, 1 mar 2026 a la(s) 11:51 a.m., Pablo Rodriguez via ntg-context (
ntg-context@ntg.nl) escribió:
> On 3/1/26 15:05, Jairo A. del Rio wrote:
> > […]
> > I expected something like "IranMasoudPezeshkiansurgeon", but the
> > "content" attribute with name="name" repeats thrice. I tried with other
> > cases and I have the same result: the first result repeats. Any ideas on
> > what's happening? Regards
>
> Hi Jairo,
>
> it’s in the details, lpaths expect this syntax:
>
> element[@attribute='value']
>
> This is actually indepedent from `\xmlattribute`, but this is part of
> the lpath/xpath selection (as already mentioned by Denis).
>
> To get something like "Name Value: profession (country)", your relevant
> code should read:
>
> \startxmlsetups xml:document
> \xmlattribute{#1}{meta[@name='name']}{content}:\
> \xmlattribute{#1}{meta[@name='profession']}{content}\
> (\xmlattribute{#1}{meta[@name='country']}{content})
> \stopxmlsetups
>
> I hope it helps,
>
> Pablo
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
>
> ___________________________________________________________________________________
>
[-- Attachment #1.2: Type: text/html, Size: 2760 bytes --]
[-- Attachment #2: Type: text/plain, Size: 511 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* [NTG-context] Re: Another XML question
2026-03-04 2:58 ` Jairo A. del Rio
@ 2026-03-04 18:49 ` Pablo Rodriguez via ntg-context
2026-03-04 20:56 ` Henning Hraban Ramm
0 siblings, 1 reply; 9+ messages in thread
From: Pablo Rodriguez via ntg-context @ 2026-03-04 18:49 UTC (permalink / raw)
To: ntg-context; +Cc: Pablo Rodriguez
On 3/4/26 03:58, Jairo A. del Rio wrote:
> Thank you very much, Pablo! Sorry for the late answer. Since examples in
> the manual weren't exactly easy to understand, I didn't realize I needed
> quotes for attribute strings. Again, thanks for the remark and the example.
Glad to read it helped, Jairo.
Of course, a delayed reply is perfectly fine.
I think “Dealing with XML in ConTeXt MkIV” (or `xml-mkiv.pdf`) is hard
to understand due to the lack of previous exposure to XPath (at least,
this was mainly my experience).
Examples from the manual may seem even too dry, but finding more verbose
and different samples belongs ot another kind of document (mainly
written by users, not by Hans).
Pablo
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* [NTG-context] Re: Another XML question
2026-03-04 18:49 ` Pablo Rodriguez via ntg-context
@ 2026-03-04 20:56 ` Henning Hraban Ramm
2026-03-05 6:26 ` Pablo Rodriguez via ntg-context
0 siblings, 1 reply; 9+ messages in thread
From: Henning Hraban Ramm @ 2026-03-04 20:56 UTC (permalink / raw)
To: ntg-context
Am 04.03.26 um 19:49 schrieb Pablo Rodriguez via ntg-context:
> I think “Dealing with XML in ConTeXt MkIV” (or `xml-mkiv.pdf`) is hard
> to understand due to the lack of previous exposure to XPath (at least,
> this was mainly my experience).
XPath (or LPath in ConTeXt) should not be hard to understand, but it is
for me, too.
> Examples from the manual may seem even too dry, but finding more verbose
> and different samples belongs ot another kind of document (mainly
> written by users, not by Hans).
Have a look at this tutorial by Thomas Schmitz:
https://articles.contextgarden.net/journal/2019/42-53.pdf
Hraban
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* [NTG-context] Re: Another XML question
2026-03-04 20:56 ` Henning Hraban Ramm
@ 2026-03-05 6:26 ` Pablo Rodriguez via ntg-context
2026-03-05 8:50 ` Hans Hagen via ntg-context
0 siblings, 1 reply; 9+ messages in thread
From: Pablo Rodriguez via ntg-context @ 2026-03-05 6:26 UTC (permalink / raw)
To: ntg-context; +Cc: Pablo Rodriguez
On 3/4/26 21:56, Henning Hraban Ramm wrote:
> Am 04.03.26 um 19:49 schrieb Pablo Rodriguez via ntg-context:
>> I think “Dealing with XML in ConTeXt MkIV” (or `xml-mkiv.pdf`) is hard
>> to understand due to the lack of previous exposure to XPath (at least,
>> this was mainly my experience).
>
> XPath (or LPath in ConTeXt) should not be hard to understand, but it is
> for me, too.
It is lack of experience (at least in my case) what makes it harder to
understand, because a new mental model (or approach) is needed.
Basic CSS selectors (also implemented for XML handling) may be easier in
some cases (although, I must admit, I feel like cheating).
>> Examples from the manual may seem even too dry, but finding more verbose
>> and different samples belongs ot another kind of document (mainly
>> written by users, not by Hans).
>
> Have a look at this tutorial by Thomas Schmitz:
> https://articles.contextgarden.net/journal/2019/42-53.pdf
I’m afraid it doesn’t cover more complex lpaths than elements (as it
should be the case with an introductory article).
Many thanks for your helpm
Pablo
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* [NTG-context] Re: Another XML question
2026-03-05 6:26 ` Pablo Rodriguez via ntg-context
@ 2026-03-05 8:50 ` Hans Hagen via ntg-context
2026-03-05 17:12 ` Pablo Rodriguez via ntg-context
0 siblings, 1 reply; 9+ messages in thread
From: Hans Hagen via ntg-context @ 2026-03-05 8:50 UTC (permalink / raw)
To: ntg-context; +Cc: Hans Hagen
On 3/5/2026 7:26 AM, Pablo Rodriguez via ntg-context wrote:
> On 3/4/26 21:56, Henning Hraban Ramm wrote:
>> Am 04.03.26 um 19:49 schrieb Pablo Rodriguez via ntg-context:
>>> I think “Dealing with XML in ConTeXt MkIV” (or `xml-mkiv.pdf`) is hard
>>> to understand due to the lack of previous exposure to XPath (at least,
>>> this was mainly my experience).
>>
>> XPath (or LPath in ConTeXt) should not be hard to understand, but it is
>> for me, too.
>
> It is lack of experience (at least in my case) what makes it harder to
> understand, because a new mental model (or approach) is needed.
>
> Basic CSS selectors (also implemented for XML handling) may be easier in
> some cases (although, I must admit, I feel like cheating).
>
>>> Examples from the manual may seem even too dry, but finding more verbose
>>> and different samples belongs ot another kind of document (mainly
>>> written by users, not by Hans).
>>
>> Have a look at this tutorial by Thomas Schmitz:
>> https://articles.contextgarden.net/journal/2019/42-53.pdf
>
> I’m afraid it doesn’t cover more complex lpaths than elements (as it
> should be the case with an introductory article).
>
> Many thanks for your helpm
there are some exaples in the test suite
Hans
-----------------------------------------------------------------
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 / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* [NTG-context] Re: Another XML question
2026-03-05 8:50 ` Hans Hagen via ntg-context
@ 2026-03-05 17:12 ` Pablo Rodriguez via ntg-context
0 siblings, 0 replies; 9+ messages in thread
From: Pablo Rodriguez via ntg-context @ 2026-03-05 17:12 UTC (permalink / raw)
To: ntg-context; +Cc: Pablo Rodriguez
On 3/5/26 09:50, Hans Hagen via ntg-context wrote:
> […]
> there are some exaples in the test suite
Many thanks for the info, I think I can catch them with:
grep -irl xmlregistersetup . | xargs xed
It would be great that the test suite could be installed and updated
with an `mtxrun --script` command, but I have already mentioned that in
a previous message.
Many thanks for your help,
Pablo
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-03-05 17:12 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-01 14:05 [NTG-context] Another XML question Jairo A. del Rio
2026-03-01 14:24 ` [NTG-context] " Denis Maier via ntg-context
2026-03-01 16:46 ` Pablo Rodriguez via ntg-context
2026-03-04 2:58 ` Jairo A. del Rio
2026-03-04 18:49 ` Pablo Rodriguez via ntg-context
2026-03-04 20:56 ` Henning Hraban Ramm
2026-03-05 6:26 ` Pablo Rodriguez via ntg-context
2026-03-05 8:50 ` Hans Hagen via ntg-context
2026-03-05 17:12 ` Pablo Rodriguez via ntg-context
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).