1. separate data from display. xml data: <xml> <title> test title </title> <content> test content </content> <top> banner </top> <left> sidebar </left> <body> main body </body> <end> end of the page </end> </xml> test. xslt template: <? Xml version = "1.0" encoding = "UTF-8"?> <Xsl: stylesheet version = "1.0" xmlns: xsl = "http://www.w3.org/5o/#/transform"> <xsl: output method =" html "encoding =" UTF-8 "/> <xsl: template name = "index" match = "xml"> <xsl: value-of select = "document (")/*/xsl: template [@ name = DOCTYPE]/node () "disable-output-escaping =" yes "/> </xsl: template>
Such a split design can make the page more flexible. modifying any part at Will 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: <xml>