note 34525 added to function.xslt-process
| From: | php at Bothware dot com | Date: | Wed, 30 Jul 2003 00:12:11 +0000 |
| Subject: | note 34525 added to function.xslt-process | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-52975@lists.php.net to get a copy of this message | ||
If you are getting errors due to unrecognised entities then try this function :
function superXmlEntities($input) {
$entities = array(128 => '#8364', 130 => '#8218', 131 =>
'#402', 132 => '#8222', 133 => '#8230', 134 =>
'#8224', 135 => '#8225', 136 => '#710', 137 =>
'#8240', 138 => '#352', 139 => '#8249', 140 =>
'#338', 145 => '#8216', 146 => '#8217', 147 =>
'#8220', 148 => '#8221', 149 => '#8226', 150 =>
'#8211', 151 => '#8212', 152 => '#732', 153 =>
'#8482', 154 => '#353', 155 => '#8250', 156 =>
'#339', 159 => '#376');
$output = '';
for($i = 0; $i < strlen($input); $i++) {
$num = ord($input[$i]);
if(array_key_exists($num, $entities)) {
$output .= '&'.$entities[$num].';';
} elseif($num < 127 || $num > 159) {
$output .= $input[$i];
}
}
return $output;
}
If your output contains some "random" characters, try this :
function correctXSLT( $s ) {
$r = str_replace('â', '’', $s);
$r = str_replace('â', '‘', $r);
$r = str_replace('â', '“', $r);
$r = str_replace('â', '”', $r);
$r = str_replace('â¦', '…', $r);
return $r;
}
Please note that these characters may not be showing up correctly on this documentation page ! - the
second character in each replacement is actually the euro symbol !
Hope this helps anyone who runs into the same issues which I did -- I'll also post as a bug,
but I thought others would like this "work arround" in the meantime.
----
Manual Page -- http://www.php.net/manual/en/function.xslt-process.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34525
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34525&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34525&report=yes