1. separate the data from the display: xmltitletesttitle/titlecontenttestcontent/contenttopbanner/topleftsidebar/leftbodymainbody/Tables/end/xmltest 1. separate the data from the display: Test title Test content Banner Sidebar Main body End of the page Test. xslt template: Test <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2. the php program is automatically generated on the webpage to read the config file. the target page config file is generated based on the specified target file name, data file name, and template file name: Test.html Test. xml Test. xslt Php code: Load ("$ xsl"); $ xmlDoc = new DOMDocument (); $ xmlDoc-> load ("$ xml"); $ proc = new XSLTProcessor (); $ proc-> importStylesheet ($ export Doc); $ html = $ proc-> transformToXML ($ xmlDoc); if (! ($ Filehandler = fopen ($ name, "w +") {die ("cocould not open $ name output");} fwrite ($ filehandler, $ html ); fclose ($ filehandler) ;}$ parser = xml_parser_create (); xml_set_element_handler ($ parser, "startElement", "endElement"); combine ($ parser, "characterData "); if (! ($ Filehandler = fopen ($ xml_file, "r") {die ("cocould not open XML input");} while ($ data = fread ($ filehandler, 4096) {if (! Xml_parse ($ parser, $ data, feof ($ filehandler) {die (sprintf ("XML error: % s at line % d ", xml_error_string (xml_get_error_code ($ parser), iterator ($ parser) ;}} fclose ($ filehandler); xml_parser_free ($ parser); foreach ($ arr as $ sub_arr) {$ I = 0; foreach ($ sub_arr as $ obj) {if ($ I = 0) {$ name = $ obj;} if ($ I = 1) {$ xml = $ obj;} if ($ I = 2) {$ xsl = $ obj;} $ I ++;} buildHtml ($ name, $ xml, $ xsl );} ?> 3. reschedule the entire page Such a split design can make the page more flexible. modifying any part at will not affect the rest of the blocks, and can constantly change the data of a specific block, such as the body. xml to generate more new pages, which is especially suitable for news systems or forums. xml: Banner Top. xslt: Left. xml left. too tend. xml end. xslt and so on. same as top body. xml: Test title Test content Main body Body. xslt: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> Config file: Top_imp.xslt Top. xml Top. xslt Left_imp.xslt Left. xml Left. xslt End_imp.xslt End. xml End. xslt Test.html Body. xml Body. xslt 4. data transmission and reuse Body. xml: Test adImage_1.jpgimage_2.jpgimage_3.jpg Test title Test content Main body Body. xslt: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> Left. xslt: 70 132 Top. xslt: The config file remains unchanged. the web page is automatically generated after the PHP script is run. increase the CSS utilization rate to share the CSS, that is, all CSS styles that can be shared on the page are extracted, such as the text style of the body and the text style of the advertisement, it can be extracted as a CSS, and the height extraction CSS can be reused to help rapid webpage development and even share with data providers (XML data editors, this saves a lot of trouble in page building.