At 06:42 PM 6/28/2004, you wrote:
> > you don't need XSLT2 for that (unless you want named entities).
>Right. That would be important. As I just said, memorising large
>numbers of numbers is a burden I wouldn't wish on anyone.
> > in XSLT1 you *could* do named entities with a long and painful
> > set of substring matches.
>Hence I'd rather avoid the problem altogether and keep the master
>in a format which preserves the character entities and generate
>proper Unicode files from it. Until such time as we're happy all
>the users can handle them without problems.
I would assume you would keep the master in the richest possible
open-and-standard format compatible with your lowest-common-denominator
platform; named character entities are fine for that, assuming your
parsing/validation framework supports them.
If faced with converting *into* named (character) entities from UTF-8
characters or numeric character references or anything else your parser can
handle, the bottom line is that (a) XSLT 2 provides direct support for
this, and (b), as Sebastian says, it can also be accomplished in XSLT 1.
While the XSLT 1 transform is rather gnarly (string-handling is not XSLT's
forte: it would entail a recursive template, oo scary!), it would only have
to be written once, the code for it is readily available or can be
rewritten (i.e. this routine has been written more than once already), and
the bulk of the work would actually be in creating and maintaining a table
of characters-to-names (which could of course be derived from your entity
declaration set). Other string-handling technologies such as Perl would
also do just fine here: it really isn't rocket science.
A little research on line, including EXSL.org and perhaps the XSL FAQ,
would get you further on this problem, which is essentially a table-driven
string substitution routine plus (if using XSLT 1.0) the
disable-output-escaping hack to get entity references in the output (okay
here because the whole point is to drive the serializer).
Wendell Piez mailto:[log in to unmask]
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
Mulberry Technologies: A Consultancy Specializing in SGML and XML