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

Re: Is there a way to use character-map to do replace

Subject: Re: Is there a way to use character-map to do replacements in a string ?
From: "Christophe Marchand cmarchand@xxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 19 Mar 2019 16:28:41 -0000
Re:  Is there a way to use character-map to do  replace
I can survive with a global variable which is a map !

Thanks a lot !

Christophe

Le 19/03/2019 C 17:23, Martin Honnen martin.honnen@xxxxxx a C)critB :
On 19.03.2019 16:15, Christophe Marchand cmarchand@xxxxxxxxxx wrote:
I have a variable :
<xsl:variable name="content" as="xs:string" select='EC'/>

I want to transform special caracters according to a character-map
definition (I think it's much easier to maintain) :
B B  <xsl:character-map name="cm">
B B B B  <xsl:output-character character="E" string="oe"/>
B B B B  <xsl:output-character character="C" string="ss"/>
B B  </xsl:character-map>

Something like
<xsl:variable name="escaped" as="xs:string"
select="escape-according-tocharacter-map($content, 'cm')"/>

Is there a way to do it with XSLT 3.0 ?


The serialize function from XPath 3 allows you to supply a character map
but in XPath 3.1 map syntax

serialize($content, map { 'method' : 'text', 'use-character-maps' : map
{ 'E' : 'oe', 'C' : 'ss' }})

I am currently not sure there is a way to reference a map in the
stylesheet, other than perhaps using

B  map:join(document('')/*/xsl:character-map[@name =
'cm']/xsl:output-character/map-entry(@character, @string))

instead of the hardcoded map { 'E' : 'oe', 'C' : 'ss' }}

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.