ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* xml and catcode switching
@ 2010-03-22  9:53 Philipp Gesang
  2010-03-23 17:48 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Philipp Gesang @ 2010-03-22  9:53 UTC (permalink / raw)
  To: ntg-context


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

Hi,


I'm formatting lots of urls and as some of them have ampersands in them
I switch & to letter wherever they are placed.  This works fine unless
combined with XML which seems to impose its own catcodes on things.  How
could I fix things in the following example?

Thanks for any suggestions,


Philipp

···8<··········································································
\useURL
  [testurl]
  [http://elibrary.karelia.ru/book.shtml?levelID=004002&id=2570&cType=2]
  []
  [http://elibrary.karelia.ru/book.shtml?levelID=004002&id=2570&cType=2]  % these ampersands cause it

\startxmlsetups urltest
\xmlsetsetup{urltest}{main|url}{xml:*}
\stopxmlsetups

\xmlregistersetup{urltest}

\startxmlsetups xml:main
\xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:url
\begingroup
  \catcode`\&=11
  \from[testurl]
\endgroup
\stopxmlsetups

\startbuffer[urltestbuf]
<main>
  <url/>
</main>
\stopbuffer

\starttext
Test
{\catcode`\&=11 \from[testurl]}           % this one works: no xml
\xmlprocessbuffer{urltest}{urltestbuf}{}
Test
\stoptext
···8<··········································································



-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 486 bytes --]

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-03-24  7:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-22  9:53 xml and catcode switching Philipp Gesang
2010-03-23 17:48 ` Hans Hagen
2010-03-24  7:50   ` Philipp Gesang

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