Copyright statement: original works can be reproduced. During reprinting, you must mark the original publication, author information, and this statement in hyperlink form. Otherwise, legal liability will be held. Http://blog.csdn.net/mayongzhan-ma yongzhan, myz, mayongzhan
Run echo. php, OK,
XML is displayed in XSL format
// Main file: Echo. php // ---------------------------------------------------------- <? PHP/*** @ name echo. PHP * @ date Fri Sep 21 00:43:33 CST 2007 * @ copyright Ma yongzhan (myz) * @ author ma yongzhan (myz) * @ link http://blog.csdn.net/mayongzhan/ */header ("Content-Type: text/html; charset = UTF-8 "); $ xml = new domdocument (); $ XML-> load (" data. XML "); $ XSL = new domdocument (); $ XSL-> load (" style. XSL "); $ export proc = new export tprocessor (); $ export proc-> importstylesheet ($ XSL); echo $ export proc-> transformtoxml ($ XML);?> // XML file: Data. xml // ----------------------------------------------------------- <? XML version = "1.0" encoding = "UTF-8"?> <Works> <work name = "architecture"/> <work name = "management"/> <work name = "business"/> </Works> // XSL file: style. XSL // ------------------------------------------------------------- <? XML version = "1.0" encoding = "UTF-8"?> <XSL: stylesheet xmlns: XSL = "http://www.w3.org/1999/XSL/Transform" version = "1.0"> <XSL: output method = "html"/> <XSL: template match = "/"> <HTML> <body> <XSL: For-each select = "/Works/Work"> <XSL: value-of select = "@ name"/> <br/> </XSL: For-each> </body>