xsl-list
[Top] [All Lists]

RE: [xsl] Transform from UTF-8 symbol to character entity

2010-01-16 05:13:49
Hi David,

Thank you for the respons,

Actually I was inserted for curly quotes but that quote was changed as
straight quote (I think, we are using plain mails for xsl-list not an html
format, the plain mail not support the curly quote text, if am wrong please
correct.).

Your suggestion working fine, thank you so much.

Thanks,
Selva

-----Original Message-----
From: David Carlisle [mailto:davidc(_at_)nag(_dot_)co(_dot_)uk] 
Sent: Saturday, January 16, 2010 3:58 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Transform from UTF-8 symbol to character entity


If you use html output then (most likely) these will happen
automatically, for xml output then are you sure you want to do this (it
will make your output not well formed unless you also reference a DTD
that defines the entities)

I assume your input is not exactly as you show as you showed
ascii " being converted to both ldquo and rdquo and asci - being
converted to both ndash and mdash.

Assuming you are using xslt 2 the simplest way to do this is to use a
character map, you appear to be using the standard iso/html entity names
so I assume (despite the examples you gave) that you want the usual
definitions. A character map that does the right thing is avaiablable at

http://www.w3.org/2003/entities/2007/entitynamesmap.xsl


so you can use

<xsl:import
href="http://www.w3.org/2003/entities/2007/entitynamesmap.xsl"/>

<xsl:output use-character-maps="w3c-entity-names"/>

or better, take a local copy of the files in that directory and
reference the local copy.


However for most purposes it is better to use numeric chharacter
references rather than character names, in which case you just need to
specify an encoding that does not include these characters, and they
will be encoded as numeric references

<xsl:output encoding="US-ASCII"/>

for example.

David

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



Confidentiality Notice:  This transmittal is a confidential communication.  If 
you are not the intended recipient, you are hereby notified that you have 
received this transmittal in error and that any review, dissemination, 
distribution or copying of this transmittal is strictly prohibited.  If you 
have received this communication in error, please notify this office 
immediately by reply and immediately delete this message and all of its 
attachments, if any.


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--