///////////////////////////////////////////////////////////////////// // Convert.cpp - convert ".xml" to ".htm" in each line of a // // file. Then create process to invoke MSXSL.exe // // on resulting file. // // - Used as part of XSL-based web page processing // // for SU web site. // // // // Language: Visual C++, ver 7.0 // // Platform: Dell Dimension 8100, Windows 2000, SP2 // // Application: Tool to support converting web pages from // // XML/XSL to HTML // // Author: Jim Fawcett, CST 2-187, Syracuse Univ. // // (315) 443-3948, jfawcett@twcny.rr.com // ///////////////////////////////////////////////////////////////////// /* Program Operation: ================== XSL can be used to transform XML into presentation quality HTML by applying a set of rules to specific XML tags. The transformed stream can be read directly by Internet Explorer, ver 6.0. Earlier versions do not support the now standard syntax of XSL. For this reason it is desirable to direct the trasformed information to a file with an htm extension so that earlier versions of IE can render them. You can do this transformation using MSXSL.exe, which you can download from the Microsoft web site. One problem remains, however. That is that any links to other files in the site will use xml extensions, at least if you develop using IE 6. This program takes care of that last step, by fixing the link extensions. Program Interface: ================== fixExtensions *.htm ---> fixed*.htm That is, the program will process every file matching the specified pattern, in this case all the htm files. It prepends the string "fixed" to the name of each file, so that the original file is not overwritten. */ /////////////////////////////////////////////////////////////// // Build Process // /////////////////////////////////////////////////////////////// // Required Files: // // fixExtensions.cpp, stdafx.h, stdafx.cpp // // // // Compiler Command: // // cl fixExtensions.cpp stdafx.cpp // /////////////////////////////////////////////////////////////// /* Maintenance History: ==================== ver 1.0 : 11 Jan 03 - first release */ // #include "stdafx.h" #include #include #include #include "CreateUtils.h" using namespace std; const static string stylesheet = "c:/su/webpages/courses.xsl"; const static string xslProcessor = "c:/system/msxsl.exe"; std::string fileName(std::string &s) { std::string::size_type pos = s.find("."); if(pos == std::string::npos) return s; s.resize(pos,'\0'); return s; } int _tmain(int argc, _TCHAR* argv[]) { if(argc == 1) { cout << "\n Please enter name of file(s) to process on command line\n\n"; return 1; } string line; for(int i=1; i