This article uses the xml dso data binding function to implement ASP
Code And HTML code separation, so as to achieve the function of quickly changing the HTML template, because I just started to contact XML, there are a lot of not familiar with, here just put forward a little idea, if there are any mistakes in this article, please refer to them.
Currently, the quick template replacement function is basically displayed after the special tags in the replace replacement template are displayed. This increases the processing time of many ASP files. If the template file is too long, loading to the memory for processing is also a test of the server memory. XML provides a DSO data binding function. you can deliver the replacement operation to the client. to simplify HTML template creation. therefore, it is necessary to simplify the XML technical content of HTML templates as much as possible.
Simply put, this method is implemented only by using the attributes of the datasrc and dataworks HTML tags. I will not talk much about it. All instances will talk about it. The following two examples will illustrate everything.
Example 1: Single Data Display
The XML Data Islands generated using ASP are as follows.
<XML id = "xmldata">
<Xdata>
<Name> coder </Name>
<Webname> Flexible Pearl </webname>
<Weburl> http://blog.csdn.net/oyiboy </weburl>
</Xdata>
</XML>
the original HTML code displayed:
| my brief introduction |
| my name: |
|
| website name: |
|
| website address: |
|
Example 2: multiple data entries
the following is an XML data island generated using ASP.
lightweight Pearl
http://blog.csdn.net/oyiboy
estyle) crazy shoot
http://blog.csdn.net/estyle
favorite cabbage
http://blog.csdn.net/qunluo
The original HTML code displayed:
<Table datasrc = "# xmldatalist" border = 1>
<Thead>
<Tr>
<TD colspan = 2> List of csdn blogs I followed </TD>
</Tr>
<Tr>
<TD align = "center"> name </TD>
<TD align = "center"> address </TD>
</Tr>
</Thead>
<Tbody>
<Tr>
<TD> <span dataworkflow = "webname"> </span> </TD>
<TD> <a dataworks = "weburl"> <span dataworks = "weburl"> </span> </a> </TD>
</Tr>
</Tbody>
</Table>
(The above two examples can be copied to a file to view the actual running effect .)
Note: For example, thead and tbody in the original HTML code are useful when multiple records are displayed. If you do not understand what they are used, you can remove them and see what the consequences will be.
By the way, the Data Binding of images and buttons is similar to that of hyperlinks, for example: and <button dataworks = "buttonvalue"> </button>
the limitation is that the browser must support xml. shows the http://blog.csdn.net/oyiboy effect, if you want to implement http://blog.csdn.net/oyiboy the effect should be how to do. Please give pointers.