Re: [xsl] Fixing entities

Subject: Re: [xsl] Fixing entities
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 1 Apr 2003 11:16:07 +0100
> I'm trying to tidy up some xml that contains html entities such as named
> &fract12; and number &#189;

&fract12 isn't an HTML entity is it? (I'll assume this was a typoi for &frac12;)
&#189; isn't an entity reference at all, it's a character reference
and treated by an XML parser rather differently from an entity.

> I wish to map them to <character code="fract12" /> and <character code="189"
> (I will then use a utf mapping file to map them to utf codes)

&#189; will be reported by the parser in the same way as if you had just
typed character 189 at the keyboard. So you would need to use xslt
substring functions to locate this character and output the
element. this is possible but string handling in xslt is fairly basic,
and if i understand your comment correctly, what you finally want, is
what you are starting with, the unicode character with that number.

&frac12; will be a syntax error unless your document specifies a DTD
that defines this entity. If it is defined then it presumably has teh
HTML definition which is  &#189; so again this will be reported to teh
XSLT system just as if you had typed the 1/2 character at a keyboard,
XSLT will not see the entity reference at all.


This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

 XSL-List info and archive:

Current Thread