# [NTG-context] m-letter backslash codes in xml database

Sat Jan 15 14:21:41 CET 2005

Rob Ermers said this at Sat, 15 Jan 2005 02:31:32 +0100:

>h h extern wrote:
>> if you want to move things around in an encoding neutral way:
>>
>> \defineXMLsingular
>>   [c]
>>   [n=unknowncharacter]
>>   {\executeifdefined {\XMLop{id}} \unknowncharacter}
>>
>> <c n='eacute'/>

Um, I'm not sure, but I think Hans mixed two different attribute names:
the code won't work as is. It should probably be:

\defineXMLsingular
[c]
[n=unknowncharacter]
{\executeifdefined {\XMLop{n}} \unknowncharacter}

>Thanks, Hans, for the example. I do agree, but I'm sorry I don't quite
>understand how to apply this code. Could you be more specific?

It should be in a .tex file that is loaded during processing. You can do
this manually in your style file, or in (for example) a cont-loc.tex file
that's in your path (e.g., the project directory or your tex/context/user ).

>Do I still have to use the unicode number, or is this a method to use
>\"e again in the database?

This is so that you can substitute elements for entities in your
database. This is an XML database, so it's a lot more useful if you don't
restrict it to TeX-specific character entry. Entities (or elements) are a
much better option, long-term.

>Should I code each diacritic in this way, such as ouml (ö) in my
>example: <p>J. Sch&#246;ttelndreher</p>)?

<p>J. Sch&#246;ttelndreher</p>     or, if you \useXMLfilter[ent] :
<p>J. Sch&#ouml;ttelndreher</p>    or, with Hans's definition:
<p>J. Sch<c n='odiaeresis'/>ttelndreher</p>

>My solution by the way does not work with, e.g., a Turkish scedil
>(U0015F) in my database, while Tex excells in all kinds of diacritics.

This is a slightly different issue. It's fairly easily fixed with a
couple additions to the style file/cont-loc file:

% You can use &scedil; with:
\defineXMLentity [Scedil]   {\Scedilla}
\defineXMLentity [scedil]   {\scedilla}

% You can use &#351; or other unicode (decimal) numbers with:
\def\executeXMLdeccharacter#1\relax %
{\utfunifontglyph{#1}}

(I was unable to come up with a satisfactory way of handling the hex
version thereof. I also haven't really tested the above function
overload--I'm sure someone can improve on this.)
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Adam T. Lindsay, Computing Dept.     atl at comp.lancs.ac.uk
Lancaster University, InfoLab21        +44(0)1524/510.514
Lancaster, LA1 4WA, UK             Fax:+44(0)1524/510.492
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-