Thnak you.

one question: 

if you say  <xsl:output type="xml" encoding="ASCII" /> - does this mean that 
the whole target XML will be in ASCII or only the 'changed' parts? What effect 
would this have on other unicode characters that we don't want to convert? And: 
can such a XSLT also be used on export of XML to transform the ASCII back to 
Unicode without loss of data?

Met vriendelijke groet / kind regards,

Wim Hooghwinkel wimh at
DTP and XML Management

Scriptware bv
tel : +31 (0)23 548 48 84
fax : +31 (0)23 548 48 85
info at info at 

-----Original Message-----
From: John Root []
Sent: Saturday, May 06, 2006 9:43 PM
To: Wim Hooghwinkel (Scriptware); Framers List
Subject: Re: FM 7.2 XSLT and unicode characters

Hi Wim,

There is no if-else functionality in XSL. Instead, you use xsl:choose with a
series of nested xsl:when elements and an optional final xsl:otherwise.


    <xsl:when test="'foo'">Do something</xsl:when>
    <xsl:when test="'foobar'">Do something else</xsl:when>
    <xsl:otherwise>Perform some default action</xsl:otherwise>

If I understand correctly what you're trying to do, you'd want your
intermediate transform to output ASCII or whatever encoding you require by
using an xsl:output element as a child of xsl:stylesheet:

<xsl:output type="xml" encoding="ASCII" />

You would use a standard copy type scenario but include a template for text
that calls the transform function. So your transform would look something
like this:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"

     <!-- Set encoding attribute per your choice -->
    <xsl:output method="xml" encoding="ASCII" />

    <xsl:template match="/">
        <xsl:apply-templates />

    <xsl:template match="*">
            <xsl:for-each select="@*">
                <xsl:copy-of select="."/>
            <xsl:apply-templates />

    <xsl:template match="text()" priority="2">
            <xsl:when test="contains(., "UnicodeCharacter1)">
                <xsl:value-of select="translate(., "UnicodeCharacter1",
            <xsl:when test="contains(., "UnicodeCharacter2)">
                <xsl:value-of select="translate(., "UnicodeCharacter2",
            <xsl:otherwise><xsl:value-of select="."/>/xsl:otherwise>


Hope this helps,


On 5/5/06 2:43 AM, "Wim Hooghwinkel (Scriptware)" <wimh at>

> Hello all,
> I am trying to create a XSLT template to transform uncode characters to ansii
> on import of XML in FM. This concerns the unicode characters for CE/EE
> languages that can not be read by FM.
> As I don't have any experience with XSLT, could anyone point me in the right
> direction? Probably need a kind of if-else construction or variables to use
> the 'transate' function.
> How does FM react when an XSLT refers to Javascript?
> Met vriendelijke groet / kind regards,
> Wim Hooghwinkel wimh at
> DTP and XML Management

Reply via email to