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

Outputting UTF-8

Subject: Outputting UTF-8
From: "Mark Wilson pubs@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 25 Mar 2017 14:39:14 -0000
 Outputting UTF-8
While writing and testing my XSL stylesheet, the direct output was in UTF-8. However, as soon as I switched to result-document, I got garbage characters for diacritics from my original xml. That is, for 'ZC<rich', I get ' ZCB<rich'. Except for the absence of UTF-8, everything else works fine. I am assuming that I have declared result-document incorrectly, so have not included the input or full stylesheet. Below is the declaration:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="2.0">


<xsl:strip-space elements="*"/>

    <xsl:template match="/">
        <xsl:for-each select="collection('../xml/?select=*.xml')">
            <xsl:apply-templates/>
        </xsl:for-each>
    </xsl:template>

<xsl:template match="adlibXML">
<xsl:variable name="file-name-out" select="concat('../work/', substring-before((tokenize(document-uri(/),'/'))[last()], '.'), '.csv')"/>
<xsl:result-document href="{$file-name-out}" encoding="UTF-8" method="text">
<xsl:apply-templates/>
</xsl:result-document>
</xsl:template>


<!-- other templates -->
</xsl:stylesheet>

Mark Wilson

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.