Re: Help: Sablotron and Shift-jis
| From: | Moriyoshi Koizumi | Date: | Fri, 07 Mar 2003 07:50:04 +0000 |
| Subject: | Re: Help: Sablotron and Shift-jis | ||
| References: | 1 | Groups: | php.dev php.i18n php.xml.dev |
| Request: | Send a blank email to php-dev+get-94875@lists.php.net to get a copy of this message | ||
It works for me. See the attached example. Anyway, you don't have to
crosspost your question to php-dev@lists.php.net, which is for developing
php internals and irrelevant for such user questions.
Hope this helps
Moriyoshi
"Michel Sahyoun" <msahy@yahoo.com> 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
>
<?xml version="1.0" encoding="Shift_JIS" ?> <demo> < Í>aha</ Í> <¢Ð>def</¢Ð> <¤Ó>ghi</¤Ó> </demo> <?php $xp = xslt_create(); xslt_set_encoding($xp, "Shift_JIS"); xslt_process($xp, "test.xml.txt", "test.xsl.txt", "result.xml"); ?> <?xml version="1.0" encoding="Shift_JIS"?> <\ xmlns="http://www.w3.org/TR/xhtml1/strict"> <\vf content="aha"/> <\vf content="def"/> <\vf content="ghi"/> </\> <?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"> <\> <\vf content="{ Í}" /> <\vf content="{¢Ð}" /> <\vf content="{¤Ó}" /> </\> </xsl:template> </xsl:stylesheet>
<?xml version="1.0" encoding="Shift_JIS" ?> <demo> < Í>aha</ Í> <¢Ð>def</¢Ð> <¤Ó>ghi</¤Ó> </demo> <?php $xp = xslt_create(); xslt_set_encoding($xp, "Shift_JIS"); xslt_process($xp, "test.xml.txt", "test.xsl.txt", "result.xml"); ?> <?xml version="1.0" encoding="Shift_JIS"?> <\ xmlns="http://www.w3.org/TR/xhtml1/strict"> <\vf content="aha"/> <\vf content="def"/> <\vf content="ghi"/> </\> <?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"> <\> <\vf content="{ Í}" /> <\vf content="{¢Ð}" /> <\vf content="{¤Ó}" /> </\> </xsl:template> </xsl:stylesheet>