xsl-list
[Top] [All Lists]

RE: character replacement

2005-01-07 09:47:12

But that's strange, since translate only "replaces" a character and a
character reference references a character (!) i went to try

      <xsl:template match="*">
              <xsl:copy-of select="translate(., '€', '&#8364;')" />
        </xsl:template>

A character reference is just a way of inputting or outputting a character, 
XPath sees the character it represents and not the original character reference.

Incidentally, &#8364 is the Unicode Euro character. The character that you are 
replacing appears to be &#x80, which is a misrepresentation of a Euro character 
generated on some Microsoft systems including mine. I assume that's why you are 
replacing it with the correct character...

The above code should work just fine: though whether the resulting Euro 
character is represented in the output as itself or as a character reference 
depends on your selected output encoding.

Michael Kay
http://www.saxonica.com/



on this xml

<teste>$£€</teste>

and the output was

$£&#8364;

so what was your problem?

On Fri, 07 Jan 2005 16:55:26 +0100, Sven Waibel 
<sven(_dot_)waibel(_at_)imbus(_dot_)de> wrote:
Thanks this helps a lot.

Sven

António Mota wrote:

Take a look at the FAQ

http://www.dpawson.co.uk/xsl/sect2/replace.html

but since youre using character entitys maybe there is 
another way...


On Fri, 07 Jan 2005 16:42:30 +0100, Sven Waibel 
<sven(_dot_)waibel(_at_)imbus(_dot_)de> wrote:

Hello,

i want to replace in my xml file all occurrences of € 
with &#8364; because it should be display in my pdf in the right way.

I tried it with

<xsl:template match="@*|*">
       <xsl:value-of select="translate(.,'€','&#8364;')"/>
</xsl:template>

or

<xsl:template match="@*|*">
       <xsl:value-of select="replace(.,'€','&#8364;')"/>
</xsl:template>
but the function replace is not recognized

Does anybody know how to get this working?

thanks and best regards
Sven


--~---------------------------------------------------------
---------
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>
--~--





--~------------------------------------------------------------------
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>
--~--





--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--




--~------------------------------------------------------------------
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>
--~--



<Prev in Thread] Current Thread [Next in Thread>