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

* Re: xml and catcode switching
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2010-03-23 17:48 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Philipp Gesang

On 22-3-2010 10:53, Philipp Gesang wrote:
> 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?

\goto{\hyphenatedurl{...}}[url(...)]

or something like that

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | 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 / 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

* Re: xml and catcode switching
  2010-03-23 17:48 ` Hans Hagen
@ 2010-03-24  7:50   ` Philipp Gesang
  0 siblings, 0 replies; 3+ messages in thread
From: Philipp Gesang @ 2010-03-24  7:50 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Good morning!


On 2010-03-23 <18:48:15>, Hans Hagen wrote:
> On 22-3-2010 10:53, Philipp Gesang wrote:
> >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?
> 
> \goto{\hyphenatedurl{...}}[url(...)]

<facepalm> I somehow entirely missed the trivial solution: not
specifying an alternate description. </facepalm>  

Thanks for the hint with \goto, I didn't know that before.  As there was
no hit on the wiki search when asking it for “url” I created an article for
this lemma; please add the stuff I missed.


Philipp



> 
> or something like that
> 
> -----------------------------------------------------------------
>                                           Hans Hagen | PRAGMA ADE
>               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
>                                              | 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 / 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
> ___________________________________________________________________________________

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