Analysis of two schemes of CMS Content management system

Source: Internet
Author: User
Tags date cdata implement xsl xsl file client
Content management system currently on the market mature CMS products are many, there are no more than two solutions: the first is to use the Xsl+xml way to achieve client-specific data; the second is to generate HTML or shtml to implement.

The idea in the design phase is to use XSL to implement templates for articles and content, to store data in XML, and to generate static HTML or shtml. The problem of HTML conversion is found in practical applications, when HTML is generated with Xsl+xml, the content of the XML content does not need to be transformed, using CDATA, referencing the part using disable-output-escaping= "yes" in the XSL file, The HTML code is also parsed when the HTML is generated, such as <, and so on, but we have to take into account the contents of the article if there is a < problem, not a mess. Of course, there are solutions, such as adding your own customized special logo, and then transcoding, so that the HTML will not be a problem.

The purpose of CMS is to reduce the burden on the server, naturally we can add the load to the client, such as the client browser parsing xsl+ XML, but given that some browsers do not support this form, most of them can be resolved, such as Internet Explorer, Netscape, Firefox, Mozilla, opera and so on.

As an example:

XSL file: test.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= "/article"
<table cellspacing= "1" cellpadding= "1" width= "border=" 1 ""
<tbody>
<tr>
<td> <xsl:value-of select= "title"/> </td>
<td> <xsl:value-of select= "click"/> </td>
</tr>
<tr>
<td> <xsl:value-of select= "date"/> </td>
<td> <xsl:value-of select= "Author"/> </td>
</tr>
<tr>
<td> <xsl:value-of select= "content" disable-output-escaping= "yes"/> </td>
<td> Test by Glandjacky </td>
</tr>
</tbody>
</table>
</xsl:template>
</xsl:stylesheet>
XML file: View.xml

<?xml version= "1.0" encoding= "Utf-8"?
<?xml-stylesheet type= "text/xsl" href= "test.xsl"?
<article>
<id> All </id>
<title> Test XML </title>
<icategoryId> One </icategoryId>
<key> Test XML </key>
<content>
! [cdata[
<table cellspacing= "1" cellpadding= "1" width= "border=" 1 ""
<tbody>
<tr>
<td> Test XML </td>
<td> </td>
</tr>
<tr>
<td> Test XML </td>
<td> </td>
</tr>
<tr>
<td> Test XML </td>
<td> </td>
</tr>
</tbody>
</table>
]]>
</content>
<author> Glandjacky </author>
<date> 2006-06-20 11:38:50.823 </date>
<updateBy> have not update user </updateBy>
<updateTime> have not update time </updateTime>
<click> 0 </click>
<fileUrl>/star/boke/1150774719245/1150774719245.htm </fileUrl>
<imageUrl>/star/boke/1150774719245/images/Test 2 </imageUrl>
</article>
If the browser supports it, you can enter the address of the XML file directly in the browser and see the HTML file that the browser parsed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.