Hey all,
> I believe the FAQ XML and HTML files are out of sync with each other. With > that in mind I will attempt to sync them (I think the XML is more up to > date). > > During this process I will add this FAQ. However I am not sure I like > posting a work around for the problem. I would rather fix the problem but > that is beyond my skills. So until it is fixed, I will post the work > around. > > I have been teaching myself XML and XSLT and may try and update the pages > totally. I may remove the '+' to expand/contract the FAQ feature as it is > not browser independent. I still haven't heard whether or not the webserver hosting the FAQ xml/html is running PHP. It would be an extremely easy thing to do to regenerate the HTML file whenever it's older than the XML input document or XSLT stylesheet. That type of simple output caching only takes a few lines of PHP. (see below for a sample script) Also, newer versions of IE support the <?xml-stylesheet ?> tag, which loads the stylesheet on the fly. Check out http://bigaction.org/resume.xml (using IE, of course) for an example. The source of the document is the XML input file. IE sees the xml-stylesheet tag, requests the xsl stylesheet from the server, and uses MSXML to transform the xml on the client side. Using this approach would also guarantee that your visitors (again, using IE) see the most recent version of the page. Take care, Nik <?php // FAQ.php -- simple caching for DQSD HTML FAQ // This script assumes that the XSLT extension is enabled in PHP // and that the PHP version is 4.0.6 or newer. // The xslt_process function for older versions used different parameters // and is incompatible with the new function declaration. // change these to the correct filenames. $xsl_filename = "faq.xsl"; $xml_filename = "faq.xml"; $html_filename = "faq.html"; // shouldn't have to modify anything below this line $html_timestamp = filemtime($html_filename); // avoid calling twice if (($html_timestamp < filemtime($xsl_filename)) || ($html_timestamp < filemtime($xml_filename))) { $xh = xslt_create(); if(! @xslt_process($xh, $xml_filename, $xsl_filename, $html_filename)) { // error in xslt_process! Write the error to the HTML file // so that it will be displayed instead of the old FAQ. // This is, of course, totally unnecessary, but might help // debug problems while writing the XML and/or XSL files. $fp = fopen($html_filename, 'w'); fwrite($fp, "Error processing stylesheet: " . xslt_error($xh)); fclose($fp); } } // HTML file has, if outdated, been rewritten. Now just echo the // contents to the client. if(version_compare(php_version(), "4.3.0", ">=")) { echo file_get_contents($html_filename); } else { echo implode('', file($html_filename)); } ?> Also -- if PHP is installed, but the XSLT extension is NOT (it's easy to enable, I wonder why it wouldn't be...), then I can easily rewrite the xslt_process() part to run whatever command line XSLT processor is installed via some shell execution functions. nik ------------------------------------------------------- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com _______________________________________________ DQSD-Devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dqsd-devel
