Retourner au contenu associé (journal : Site multi-lingue)
Posté par Samaty Tramo le 12 mai 2003 à 18:34. En réponse au journal Site multi-lingue. Évalué à 1.
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
[^] # Ma reponse à ma question
Posté par Samaty Tramo . En réponse au journal Site multi-lingue. Évalué à 1.
On pourrait regretter l ouverture en fichier texte et non xml qui serait pratique pour faire des ajout à l xml avant de l envoyer au passeur xslt
Noter que l on pourrait gérer un cache pour éviter de faire la transformation xslt a chaque appel de page.
<?php
// Include the DeviceType() function.
INCLUDE("xmllib.inc");
// What are the XML and XSL files?
$xmlFile = "news.xml";
$xslFile = DeviceType();
// Create a new processor handle
$th = @xslt_create() or die("Can't create XSLT handle!");
// Open the XML and XSL files
$xh = fopen($xmlFile, "r") or die("Can't open XML file");
$sh = fopen($xslFile, "r") or die("Can't open XSL file");
// Read in the XML and XSL contents
$xmlContent = fread($xh, filesize($xmlFile));
$xslContent = fread($sh, filesize($xslFile));
// Perform the XSL transformation
@xslt_process($xslContent, $xmlContent, $XSLtransformation);
// send the correct WAP header if necessary
if ($xslFile == "wapnews") :
header("content-type: text/vnd.wap.wml");
endif;
// Output the transformed XML file
echo $XSLtransformation;
// Free up the resources
@xslt_free($th);
?>
d autre avis ?