Function GeneraHtml(mode,id)
if id>0 then
sql = "select * from articoli where idArticolo="&id
Set rs = Conn.Execute(sql)
if not rs.Eof then
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
Response.Buffer = TRUE
Dim XML
Dim XSL
' Carica L'xml
Set XML = Server.CreateObject("Microsoft.XMLDOM")
XML.async = false
XML.setProperty "ServerHTTPRequest", true
XML.load(url_base&"/xml.asp?id="&id)
if len(rs("FileXsl"))>0 then
‘ Alloco la variabile fso e controllo se esiste fisicamente l’xsl
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(path_base_xsl&rs("FileXsl")) Then
‘ Carico L’xsl
set XSL = Server.CreateObject("Microsoft.XMLDOM")
XSL.async = false
XSL.setProperty "ServerHTTPRequest", true
XSL.load(url_base_xsl&rs("FileXsl"))
ShowTest = ""
‘ Controllo se l’xml è ben formattato e non contiene errori.
if xml.parseerror.errorcode <> 0 then
strResponse = "-NO:Error loading XML Document :" & "
"&_
"----------------------------" & "
"&_
"Xml :" & url_base&"/xml.asp?id="&id & "
"&_
"Error Code : " & xml.parseError.errorcode & "
"&_
"Reason : " & xml.parseError.reason & "
"
End If
‘ Controllo se l’xsl è ben formattato e non contiene errori.
if xsl.parseerror.errorcode <> 0 then
strResponse = "-NO:Error loading XSL Document :" & "
"&_
"----------------------------" & "
"&_
"Xsl :" & url_base_xsl&rs("FileXsl") & "
"&_
"Error Code : " & xsl.parseError.errorcode & "
"&_
"Reason : " & xsl.parseError.reason & "
"
End if
‘ Se non viene restituito nessun errore allora scrivo su file o su schermo
if (xml.parseerror.errorcode=0) and (xsl.parseerror.errorcode=0) then
Html = RipristinaCaratteri(XML.transformNode(XSL))
strResponse ="+OK"
if mode = 1 then
response.write(Html)
Else
call ScriviSuFile(Html,path_base_file_da_generare&rs("NomeFile"))
End if
End if
Else
StrResponse = "-NO: Errore di sistema [XSL mancante]"
End if
Else
StrResponse = "-NO: Errore di sistema [XSL mancante]"
End if
Else
StrResponse = "-NO: Errore di sistema"
End if
Else
strResponse = "-NO: Errore di Caricamento XSL "
End if
GeneraHtml = strResponse
End Function