ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] Question on XML processing
@ 2026-02-21  0:02 Jairo A. del Rio
  2026-02-21  9:23 ` [NTG-context] " Denis Maier via ntg-context
  0 siblings, 1 reply; 4+ messages in thread
From: Jairo A. del Rio @ 2026-02-21  0:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Hi. I'm trying to process XML files in ConTeXt and I'm struggling with
Docbook quotes and verses. I want to print attributions at the end of each
text, but I don't know how to extract text not inside a tag. MWE and output
attached:

\startbuffer[xmltest]
<blockquote>
  <attribution>
  Bertolt Brecht
  <citetitle>Questions From a Worker Who Reads</citetitle>
  </attribution>
  <simpara>
  Every page a victory.
  Who cooked the feast for the victors?

  Every 10 years a great man.
  Who paid the bill?
  </simpara>
</blockquote>
\stopbuffer

\startxmlsetups xml:blockquote
  \startblockquote
  \xmlall{#1}{/!attribution}
  \blank
  \xmldoiftext{#1}{/attribution}{
    \xmlall{#1}{/attribution/!citetitle}{
      % Braces and parentheses just for testing
      [\xmltext{#1}{/attribution/!citetitle}] % It must be "Bertolt Brecht"
    }
    \xmldoiftext{#1}{/attribution/citetitle}{
      (\xmltext{#1}{/attribution/citetitle})
    }
  }
  \stopblockquote
\stopxmlsetups

\startxmlsetups xml:mysetups
  \xmlsetsetup{#1}{blockquote}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:mysetups}

\starttext
  \xmlprocessbuffer{main}{xmltest}{}
\stoptext

Best regards,
Jairo

[-- Attachment #1.2: Type: text/html, Size: 1480 bytes --]

[-- Attachment #2: test001.pdf --]
[-- Type: application/pdf, Size: 8768 bytes --]

[-- Attachment #3: 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] 4+ messages in thread

* [NTG-context] Re: Question on XML processing
  2026-02-21  0:02 [NTG-context] Question on XML processing Jairo A. del Rio
@ 2026-02-21  9:23 ` Denis Maier via ntg-context
  2026-02-21  9:35   ` Denis Maier via ntg-context
  2026-02-21 11:31   ` Jairo A. del Rio
  0 siblings, 2 replies; 4+ messages in thread
From: Denis Maier via ntg-context @ 2026-02-21  9:23 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Denis Maier

[-- Attachment #1: Type: text/html, Size: 3361 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] 4+ messages in thread

* [NTG-context] Re: Question on XML processing
  2026-02-21  9:23 ` [NTG-context] " Denis Maier via ntg-context
@ 2026-02-21  9:35   ` Denis Maier via ntg-context
  2026-02-21 11:31   ` Jairo A. del Rio
  1 sibling, 0 replies; 4+ messages in thread
From: Denis Maier via ntg-context @ 2026-02-21  9:35 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Denis Maier

[-- Attachment #1: Type: text/html, Size: 3763 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] 4+ messages in thread

* [NTG-context] Re: Question on XML processing
  2026-02-21  9:23 ` [NTG-context] " Denis Maier via ntg-context
  2026-02-21  9:35   ` Denis Maier via ntg-context
@ 2026-02-21 11:31   ` Jairo A. del Rio
  1 sibling, 0 replies; 4+ messages in thread
From: Jairo A. del Rio @ 2026-02-21 11:31 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

El sáb., 21 de febrero de 2026 4:38 a. m., Denis Maier via ntg-context <
ntg-context@ntg.nl> escribió:

> Can't test right now, but you could test for text nodes with the parent
> (not ancestor) attribution. Or you search for text nodes under attribution
> but exclude those with a parent citetitle.
> Or you could use xmlfilter: send citetitle to a setup that does nothing ...
>

Using a dummy setup for citetitle works. Thank you very much!

Jairo A. del Rio <jairoadelrio6@gmail.com> hat am 21.02.2026 01:02 CET
> geschrieben:
>
>
> Hi. I'm trying to process XML files in ConTeXt and I'm struggling with
> Docbook quotes and verses. I want to print attributions at the end of each
> text, but I don't know how to extract text not inside a tag. MWE and output
> attached:
>
> \startbuffer[xmltest]
> <blockquote>
>   <attribution>
>   Bertolt Brecht
>   <citetitle>Questions From a Worker Who Reads</citetitle>
>   </attribution>
>   <simpara>
>   Every page a victory.
>   Who cooked the feast for the victors?
>
>   Every 10 years a great man.
>   Who paid the bill?
>   </simpara>
> </blockquote>
> \stopbuffer
>
> \startxmlsetups xml:blockquote
>   \startblockquote
>   \xmlall{#1}{/!attribution}
>   \blank
>   \xmldoiftext{#1}{/attribution}{
>     \xmlall{#1}{/attribution/!citetitle}{
>       % Braces and parentheses just for testing
>       [\xmltext{#1}{/attribution/!citetitle}] % It must be "Bertolt
> Brecht"
>     }
>     \xmldoiftext{#1}{/attribution/citetitle}{
>       (\xmltext{#1}{/attribution/citetitle})
>     }
>   }
>   \stopblockquote
> \stopxmlsetups
>
> \startxmlsetups xml:mysetups
>   \xmlsetsetup{#1}{blockquote}{xml:*}
> \stopxmlsetups
>
> \xmlregistersetup{xml:mysetups}
>
> \starttext
>   \xmlprocessbuffer{main}{xmltest}{}
> \stoptext
>
> Best regards,
> Jairo
> ___________________________________________________________________________________
>
> 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
> ___________________________________________________________________________________can
>
>
>
> ___________________________________________________________________________________
> 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: 5592 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] 4+ messages in thread

end of thread, other threads:[~2026-02-21 11:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-21  0:02 [NTG-context] Question on XML processing Jairo A. del Rio
2026-02-21  9:23 ` [NTG-context] " Denis Maier via ntg-context
2026-02-21  9:35   ` Denis Maier via ntg-context
2026-02-21 11:31   ` Jairo A. del Rio

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).