[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: special characters

Subject: Re: special characters
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Fri, 23 May 2003 11:38:53 +0100
map characters
Hi,

> how can you make special characters(like &eacute;) appairs in a text
> output file in xsl encoding?

I thought I'd take this opportunity to describe one of the new
features in XSLT 2.0 -- the ability to map characters in text nodes
and attribute values during output onto arbitrary strings. This is
done through a "character map".

To say that é should be output as &eacute;, for example, you can
create a character map as follows:

<xsl:character-map name="latin-1">
  <xsl:output-character character="&#xE9;" string="&amp;eacute;" />
</xsl:character-map>

and reference this character map from your output definition:

<xsl:output use-character-maps="latin-1" />

When the result tree is output, every occurrence of é, in text or in
attribute values, will be replaced by the string &eacute;.

Note that this will work for é characters that get into the output
from being part of the source document as well as the é characters
that you use in your stylesheet. It also does the replacement in
attribute values as well as text nodes. In both ways it's more
powerful than d-o-e.

Of course that might mean that your output is not well-formed, because
there's no guarantee that the output has an entity declaration for the
&eacute; entity, so you should usually specify a doctype-system so
that the output includes a DOCTYPE declaration that contains the
relevant entity declaration.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.