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

RE: Output character references for all but one charac

Subject: RE: Output character references for all but one character
From: Pieter Reint Siegers Kort <pieter.siegers@xxxxxxxxxxx>
Date: Mon, 21 Jun 2004 11:58:29 -0500
xsl character
Hi Andrew,

You seem to use xslt 2.0 but you instruct the processor to use version 1.0? 

HTH,
<prs/>

-----Original Message-----
From: Andrew Welch [mailto:ajwelch@xxxxxxxxxxxxxxx] 
Sent: Monday, June 21, 2004 11:20 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Output character references for all but one character


Consider the following xml:

<node value="£">Hello&#160;World</node>

I have the problem where I need characters outside the ascii range to be
output as references, apart from the pound sign, which must remain as the
actual character.

The processor is Saxon 7.8 and is fixed.  I can't use d-o-e as the pound
sign is always an attribute value, and saxon 7.8 no longer supports d-o-e on
attributes in favour of character maps.  When I use the following
stylesheet, I get a '?' character instead of the the pound, I guess because
Saxon can't output the pound sign because it's not in the ascii range...  

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:saxon="http://saxon.net.sf/"
  exclude-result-prefixes="saxon">

<xsl:output method="xhtml" encoding="ascii" omit-xml-declaration="yes"
use-character-maps="style"/>

<xsl:character-map name="style">
  <xsl:output-character character="£" string="&#163;"/> </xsl:character-map>

<xsl:template match="@*|node()">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template>

</xsl:stylesheet>

Outputs:

<node value="?">Hello&#160;World</node>

I'm really after an exact copy of the input: 

<node value="£">Hello&#160;World</node>

Any ideas?

cheers
andrew

--+------------------------------------------------------------------
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@xxxxxxxxxxxxxxxxxxxxxx>
--+--

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.