[NTG-context] URLs in XML, escaping special characters

Denis Maier denismaier at mailbox.org
Wed Oct 7 15:42:41 CEST 2020


Hi,

I'm struggling with getting hyphenated URLs to work from XML input.
How do you enter ampersands and percent signs correctly so that they can 
be used in links?

This here doesn't really works:

================
\startxmlsetups xml:test
     \xmlsetsetup{#1}{*}{-}
     % Hauptgruppen
     \xmlsetsetup{#1}{article|ext-link}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:test}

\startxmlsetups xml:article
\starttext
     \xmlflush{#1}
\stoptext
\stopxmlsetups

\startxmlsetups xml:ext-link
     \goto{\hyphenatedurl{\xmlflush{#1}}}[url(\xmlflush{#1})]
\stopxmlsetups


\startbuffer[test]
<?xml version="1.0" encoding="utf-8" ?>
<article>
<ext-link ext-link-type="uri" 
xlink:href="http://merhav.nli.org.il/primo-explore/search?query=any,contains,Glikl&tab=default_tab&search_scope=RAMBI&vid=NLI_Rambi&mfacet=topic,include,Court%20Jews,1&mfacet=topic,include,Glueckel,%20of%20Hameln,%201646-1724,1&lang=en_US&offset=0">http://merhav.nli.org.il/primo-explore/search?query=any,contains,Glikl&tab=default_tab&search_scope=RAMBI&vid=NLI_Rambi&mfacet=topic,include,Court%20Jews,1&mfacet=topic,include,Glueckel,%20of%20Hameln,%201646-1724,1&lang=en_US&offset=0</ext-link>
</article>
\stopbuffer

\xmlprocessbuffer{test}{test}{}
=============

Visual output is ok, but the clickable link contains only the text until 
the end of the line.

Best,
Denis


More information about the ntg-context mailing list