The generated page data of the server side, in order to improve access speed, it is often necessary to generate a static HTM page. Typically, FSO can be used to generate a static HTM page. However, if the FSO is prohibited or does not use FSO, other methods need to be solved. Using XMLDOM, use its Save () method is a good solution. And, if the data is an XML format, use Save ( ) Is faster than using FSO, and the reuse rate of code is also high.
However, it should be noted that when calling an XMLDOM.SAVE () method, the default encoding method is "UFT-8". If the specified document output type is "html", since it cannot specify the encoding type, when the data contains Chinese characters, All Chinese characters will become garbled in the saved HTM data.
Workaround: Mechanism, usually the browser for the html type page, not explained for tags other than HTM tags. A. Specify the output document type "XML" b. Specify the encoding (Encoding = "GB2312") c. Specify reserved Ind retracting format (for easy reading)
EXAMPLES:
/ *** CREATE.ASP *** / <% DIM CXMLFILE, CXSLFILEDIM OXML, XSLDIM OOUTPUTDIM Chtmlfile, COUTPUTFILE
Chtmlfile = "book.htm" 'chtmlfile = "book_" & report (Replace (now, ":", "" - ",", ")," "," ") &" .htm "
CXMLFILE = Server.mappath ("Book.xml") cxslfile = server.mappath ("book.xsl") coutputfile = server.mappath (chtmlfile)
Set oxml = server.createObject ("Microsoft.xmLDom") oxml.async = false oxml.load (cxmlfile)
Set oxsl = server.createObject ("Microsoft.xmLDom") oxsl.async = false oxsl.load (cxslfile)
Set Ooutput = Server.createObject ("Microsoft.xmldom") Call Oxml.TransformNodeToObject (OxSl, Ooutput) Ooutput.save (coutputfile)
Set oxml = Nothing set oxsl = nothing set @ = Nothing
Response.Redirect (chtmlfile)%>
/ *** book.xml *** / XML version = "1.0" encoding = "gb2312"?> XML-stylesheet type = "text / xsl" href = "book.xsl"?>
: _)