note 34525 deleted from function.xslt-process by didou

From: Date: Wed, 19 May 2004 20:33:03 +0000
Subject: note 34525 deleted from function.xslt-process by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-69849@lists.php.net to get a copy of this message
Note Submitter: php@Bothware.com ---- 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('’', '&#8217;', $s); $r = str_replace('‘', '&#8216', $r); $r = str_replace('“', '&#8220;', $r); $r = str_replace('”', '&#8221;', $r); $r = str_replace('…', '&#8230', $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.

« previous php.notes (#69849) next »