I can survive with a global variable which is a map !
Thanks a lot !
Christophe
Le 19/03/2019 à 17:23, Martin Honnen martin(_dot_)honnen(_at_)gmx(_dot_)de a
écrit :
On 19.03.2019 16:15, Christophe Marchand cmarchand(_at_)oxiane(_dot_)com wrote:
I have a variable :
<xsl:variable name="content" as="xs:string" select='ϧ'/>
I want to transform special caracters according to a character-map
definition (I think it's much easier to maintain) :
<xsl:character-map name="cm">
<xsl:output-character character="œ" string="oe"/>
<xsl:output-character character="ß" string="ss"/>
</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
{ 'œ' : 'oe', 'ß' : 'ss' }})
I am currently not sure there is a way to reference a map in the
stylesheet, other than perhaps using
map:join(document('')/*/xsl:character-map[@name =
'cm']/xsl:output-character/map-entry(@character, @string))
instead of the hardcoded map { 'œ' : 'oe', 'ß' : 'ss' }}
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--