Mu Feng (first draft)
Table A:
1-0-1, this is a test
3-1-1, THIS Is A Test
4-3-1, this is a test
5-3-1, this is a test
2-0-2, this is a test
The above is an example of the BBS topic list. In general, if not using Oracle (Oracle has a query statement can automatically generate family trees, please consult the Select ... Start With ... Connect By ... statement), how to implement the list of the above example is a cost Work (I believe that many programmers have written).
If we do this to XML, what is the result?
Now we use "Select * from bbs" to query the post from the database, and return in XML format (if you use ADO, you can generate directly with its recordset.save ... AdpersistXML, of course, if you don't like ADO generated Format, available programs, such as this example):
Table B: XML Version = "1.0"?> XML-Stylesheet Type = "text / xsl" href = "b.xsl"?>
Description: Here SID is the ID number of the post, PID is the parent ID of the post. Title is the title, Content is the content of the post. The second line in the above table is to specify use B.xsl to convert XML content. This is information provided to IE5. If you use xmldom, you may not be this information. Let's take a look at how to display the XML content of the table as a form of XSL files. //www.w3.org/tr/wd-xsl>
Now, you save the contents of Table B as ABC.XML, save the contents of Table C as B.XSL, and then open in IE5, you can see the same content as Table A. It can therefore be seen that the XSL file solves the final display result. If you have multiple sub-forums, then there is no need to change the forum program, as long as you provide different XSL files for each sub-forum, you can make the version of each sub-forum regardless of the style screen or the topic arrangement will have a unique performance. If you provide a free forum service, then allow forum applicants to customize the XSL files will be a good choice. But if the client does not support XML, what should I do? The answer is simple, and the service is first converted to HTML first, and then it to the client. Below we implement this example with IIS4 / 5 IE5 ASP (the server must install IE5): <% @ Language = JScript%> <% set = server.createObject ("adoDb.recordset"); ssql = "SELECT * FROM BBS" sconn = "You write" rsxml.cursorLocation = aduseclient rsxml.open ssql, Sconn, AdopenStatic / / Specifies the XSL file location var stylefile = server.mappath ("simple.xsl"); // save the xml to xmldom var source = server.createObject ("Microsoft.xmLDom"); 'Rsxml.save Source, Adpersistxml 'I quite don't like the XML document that ADO directly save, I always do this: Dim getData, v getdata = getdata & " Source.loadXML GetData // load the xsl var style = server.createObject ("Microsoft.xmLDom"); style.async = false; style.load (stylefile); Response.write (Source.TransformNode (Style);%> Of course, since the ADO is used directly, the XML is generated directly, so the simple.xsl and the above B.XSL are different. Readers can refer to the above example and XSL reference (2000 MSDN has a more detailed XML / XSL SDK document).