
Hi, I have an xml setup like the one below. In my real document the qquads in xml:index-entry don't appear, but I haven't been able to reproduce the problem in the MWE. What could be the cause of such an issue? I don't know if this is helpful, but I had to change the line \xmlfilter{#1}{/term/command(xml:term)}\qquad\xmlfilter{#1}{/loc/command(xml :loc)} to \xmlfilter{#1}{/term/command(xml:term)} -\qquad- \xmlfilter{#1}{/loc/command(xml:loc)} to make the qquad appear. Best, Denis %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \startxmlsetups xml:test \xmlsetsetup{#1}{*}{-} \xmlsetsetup{#1}{index|index-entry}{xml:*} \stopxmlsetups \xmlregisterdocumentsetup{test}{xml:test} \definestartstop [Index] [ before={% \startnarrower[left]% \setupalign[flushleft,verytolerant,extremestretch,nohz,nothanging] \setupindenting[-\leftskip,yes,first]% \setuphead[section][indentnext=yes]% }, after=\stopnarrower, ] \startxmlsetups xml:index \startIndex \xmlflush{#1} \stopIndex \stopxmlsetups \startxmlsetups xml:index-entry \startparagraph \xmlfilter{#1}{/term/command(xml:term)}\qquad\xmlfilter{#1}{/loc/command(xml :loc)} \stopparagraph \stopxmlsetups \startxmlsetups xml:term \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:loc \xmlflush{#1} \stopxmlsetups \startbuffer[test] <?xml version="1.0" encoding="UTF-8"?> <index> <index-entry> <term>asdf</term> <loc>1</loc> </index-entry> </index> \stopbuffer \starttext \xmlprocessbuffer{test}{test}{} \stoptext %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Am 26.02.2025 um 16:40 schrieb Denis Maier via ntg-context:
Hi,
I have an xml setup like the one below. In my real document the qquads in xml:index-entry don’t appear, but I haven’t been able to reproduce the problem in the MWE. What could be the cause of such an issue?
I don’t know if this is helpful, but I had to change the line
\xmlfilter{#1}{/term/command(xml:term)}\qquad\xmlfilter{#1}{/loc/ command(xml:loc)}
to
\xmlfilter{#1}{/term/command(xml:term)} -\qquad- \xmlfilter{#1}{/loc/ command(xml:loc)}
to make the qquad appear.
My guess is you have something before the \qquad accepts a number as argument and \qquad is used as number delimiter from TeX. You can try to add either \relax, \space or \zerowidthspace before \qquad (just try what works). Wolfgang

Ok, I've found it. The problem is that I have something in the xml file that produces spurios spaces, which I try to get rid of with \removeunwantedspaces. However, this seems to have an effect on the wanted \qquad. Is there a way to remove unwanted spaces inside a given element without affecting earlier spaces (in other elements) that should appear? I guess \xmlstrip could be a solution to this problem, but I don't quite understand how this works. Best, Denis %%%%%%%%%%%%% Updated Example %%%%%%%%%%%%%%%%% \startxmlsetups xml:test \xmlsetsetup{#1}{*}{-} \xmlsetsetup{#1}{index|index-entry|num}{xml:*} \stopxmlsetups \xmlregisterdocumentsetup{test}{xml:test} \startxmlsetups xml:index \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:index-entry \startparagraph \xmlfilter{#1}{/term/command(xml:term)}\qquad\qquad\qquad\xmlfilter{#1}{/loc/command(xml:loc)} \stopparagraph \stopxmlsetups \startxmlsetups xml:term \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:loc \removeunwantedspaces \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:num \xmlflush{#1} \stopxmlsetups \startbuffer[test] <?xml version="1.0" encoding="UTF-8"?> <index> <index-entry> <term>asdf</term> <loc> <num>1</num> </loc> </index-entry> </index> \stopbuffer \starttext \xmlprocessbuffer{test}{test}{} \stoptext

On 2/27/2025 3:23 PM, Denis Maier via ntg-context wrote:
Ok, I've found it. The problem is that I have something in the xml file that produces spurios spaces, which I try to get rid of with \removeunwantedspaces. However, this seems to have an effect on the wanted \qquad. Is there a way to remove unwanted spaces inside a given element without affecting earlier spaces (in other elements) that should appear? I guess \xmlstrip could be a solution to this problem, but I don't quite understand how this works.
\xmlstrip{#1}{.} \xmlstrip{#1}{/*} or s stripped finalizer .. depends on where used
Best, Denis
%%%%%%%%%%%%% Updated Example %%%%%%%%%%%%%%%%% \startxmlsetups xml:test \xmlsetsetup{#1}{*}{-} \xmlsetsetup{#1}{index|index-entry|num}{xml:*} \stopxmlsetups
\xmlregisterdocumentsetup{test}{xml:test}
\startxmlsetups xml:index \xmlflush{#1} \stopxmlsetups
\startxmlsetups xml:index-entry \startparagraph \xmlfilter{#1}{/term/command(xml:term)}\qquad\qquad\qquad\xmlfilter{#1}{/loc/command(xml:loc)} \stopparagraph \stopxmlsetups
\startxmlsetups xml:term \xmlflush{#1} \stopxmlsetups
\startxmlsetups xml:loc \removeunwantedspaces \xmlflush{#1} \stopxmlsetups
\startxmlsetups xml:num \xmlflush{#1} \stopxmlsetups
\startbuffer[test] <?xml version="1.0" encoding="UTF-8"?> <index> <index-entry> <term>asdf</term> <loc> <num>1</num> </loc> </index-entry> </index> \stopbuffer
\starttext
\xmlprocessbuffer{test}{test}{}
\stoptext
___________________________________________________________________________________ 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 ___________________________________________________________________________________
-- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------

-----Ursprüngliche Nachricht----- Von: Hans Hagen via ntg-context
Gesendet: Freitag, 28. Februar 2025 14:30 An: ntg-context@ntg.nl Cc: Hans Hagen Betreff: [NTG-context] Re: Quads not appearing Ok, I've found it. The problem is that I have something in the xml file
On 2/27/2025 3:23 PM, Denis Maier via ntg-context wrote: that produces spurios spaces, which I try to get rid of with \removeunwantedspaces. However, this seems to have an effect on the wanted \qquad.
Is there a way to remove unwanted spaces inside a given element without affecting earlier spaces (in other elements) that should appear? I guess \xmlstrip could be a solution to this problem, but I don't quite understand how this works.
\xmlstrip{#1}{.} \xmlstrip{#1}{/*}
But this won't output anything right? This will just manipulate the (sub)tree in place? Like some sort of preprocessor? That means, I will need a combination of \xmlstrip{#1}{.} \xmlflush{#1} to actually produce the output. Is that correct? Denis
participants (3)
-
denismaier@mailbox.org
-
Hans Hagen
-
Wolfgang Schuster