Subject: Re: [xsl] Translating character entities for plain text output From: David Carlisle <davidc@xxxxxxxxx> Date: Wed, 17 Jul 2002 18:47:28 +0100 |
> I can get some funny glyphs (like  for ) you have asked for your text to be utf8 encoded (or accepted that default) a non breaking space in utf8 takes two bytes. If you incorrectly look at teh file in a latin-1 encoded terminal the firat one looks like an accented A. You can look at teh file in a utf8 capable edito, or say encodimg="iso-8859-1" on xsl:output in which case you will get byte 160 for a non breaking space. If you want to get a space then you need translate(.' ',' ') > <!ENTITY mdash " & #x2014;">. I assume that space is really a ; other wise it isn't well formed you could more easily write that as <!ENTITY mdash " —"> If you want that to end up as - you need translate(.' ','-') if you want it to be -- then you need to use a recursive string replace template (there's one in the faq) as transate() only can do one character to one character. > In the stylesheet, I've tried defining the entity in a local subset, That only affects the use of the entity in the stylesheet. there's not a lot of point in using entities in the stylesheet it's normally sompler to use the character references directly. <xsl:value-of select="translate(., '

', ' ')"/> there won't be any 
 in the input unless they have been escaped in spne way, all line endings appear as character 10, even if you are in MSDOS. peraps you tried <xsl:value-of select="translate(., '

 ', ' ')"/> but that would change 10 to space, 13 to space and 160 to nothing. You want <xsl:value-of select="translate(., '
 ', ' ')"/> note two characters in each of the translate() strings. that changes line ends and nbsp to spaces. David _____________________________________________________________________ This message has been checked for all known viruses by Star Internet delivered through the MessageLabs Virus Scanning Service. For further information visit http://www.star.net.uk/stats.asp or alternatively call Star Internet for details on the Virus Scanning Service. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Translating character entitie, Bradford, Denis | Thread | RE: [xsl] Translating character ent, Michael Kay |
Re: [xsl] <xsl:choose>'ing from dif, Antonio Fiol | Date | [xsl] sending parameters with apply, Mattias Konradsson |
Month |