note 50263 deleted from ref.dom by didou
| From: | didou@php.net | Date: | Sat, 30 Dec 2006 02:54:16 +0000 |
| Subject: | note 50263 deleted from ref.dom by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-121065@lists.php.net to get a copy of this message | ||
Note Submitter: roger4a45 at yahoo dot es
----
Output a special chars like à in your XML/XSLT
Following example create a easy XML that is transformed by a xsl i'll show below:
XSL FILE v1.xsl
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/TR/REC-html40">
<xsl:template match="TEST">
<xsl:value-of select="NAME"/><BR/>
</xsl:template>
</xsl:stylesheet>
PHP SOURCE CODE
<?php
$xml = new DOMDocument('1.0', 'utf-8'); //Change encoding to utf-8
$xsl = new DOMDocument;
$xsl->load('v1.xsl');
$proc = new XSLTProcessor;
$root = $xml->CreateElement("TEST");
$val = utf8_encode ('Andrés Poluk'); //New Line
$child = $xml->CreateElement("NAME",$val);
$root->appendChild($child);
$xml->appendChild($root);
$proc->importStyleSheet($xsl);
echo $proc->transformToXML($xml);
?>