Re: [PHP-I18N] Help: Sablotron and Shift-jis

[email protected] (Moriyoshi Koizumi) Fri, 07 Mar 2003 16:50:04 +0900
Newsgroups php.dev,php.i18n,php.xml.dev
Message-ID <[email protected]>
It works for me. See the attached example. Anyway, you don't have to 
crosspost your question to [email protected], which is for developing 
php internals and irrelevant for such user questions.

Hope this helps

Moriyoshi


"Michel Sahyoun" <[email protected]> wrote:

> Does anyone have an example of using XSLT with Sablotron to transform and
> XML document containing Shift-jis encoded characters?
> 
> I keep getting the following error message: Illegal Character for Encoding
> 'Shift-jis'
> 
> I am using the latest from snap.php.net and sablotron 0.97 FullPack with
> iconv, and Javascript.
> 
> In my php file, I call xslt_set_encoding($xsltHandle, 'Shift-jis');
> My xsl file has <xsl:output method="xml" omit-xml-declaration="yes"
> encoding="Shift-jis" />
> My XML file has: <?xml version="1.0" encoding="Shift-jis" ?>
> 
> Am I doing something wrong? Is the encoding name misspelled? Anything else I
> could check?
> 
> Thanks,
> 
> Michel
> 
> 
> 
> -- 
> PHP Internationalization Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
test.xml.txt (text/plain, 116 B)
<?xml version="1.0" encoding="Shift_JIS" ?>
<demo>
  <‚ ‚Í>aha</‚ ‚Í>
  <‚¢‚Ð>def</‚¢‚Ð>
  <‚¤‚Ó>ghi</‚¤‚Ó>
</demo>
xslt.php.txt (text/plain, 135 B)
<?php
$xp = xslt_create();
xslt_set_encoding($xp, "Shift_JIS");

xslt_process($xp, "test.xml.txt", "test.xsl.txt", "result.xml");
?>
result.xml.txt (text/plain, 175 B)
<?xml version="1.0" encoding="Shift_JIS"?>
<•\ xmlns="http://www.w3.org/TR/xhtml1/strict">
  <•\—v‘f content="aha"/>
  <•\—v‘f content="def"/>
  <•\—v‘f content="ghi"/>
</•\>
test.xsl.txt (text/plain, 366 B)
<?xml version="1.0" encoding="Shift_JIS" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
  <xsl:output method="xml" indent="yes" encoding="Shift_JIS" />
  <xsl:template match="demo">
  <•\>
    <•\—v‘f content="{‚ ‚Í}" />
    <•\—v‘f content="{‚¢‚Ð}" />
    <•\—v‘f content="{‚¤‚Ó}" />
  </•\>
  </xsl:template>
</xsl:stylesheet>