469,353 Members | 2,221 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,353 developers. It's quick & easy.

MSXML : i want to get the resultant HTML in a variable

Hi All
i m transforming a simple XSL file on Server side using MSXML Parser ...
and writting resultant HTML directly on browser .. is there any way to get
this HTML in a variable ???

i seen the article on MSDN but it makes my page blank ... plz edit my code
to make is work in this manner, if possible

Thankx in advance
Plz Help

'MY ASP FILE CODE
strxml = "<data><name>Asim</name></data>"
XSLFilePath = "C:\Emaples\test.xsl"

call TransformDocument(strXMl,XSLFilePath)

function TransformDocument(srcXML, srcXSL)
Dim sourceFile, styleFile, source
'the xsl file path
styleFile = srcXSL

set source = Server.CreateObject("MSXML2.DOMDocument")
source.async = false
source.loadXML srcXML
'Get The Style Object
set style = Server.CreateObject("MSXML2.DOMDocument")
style.async = false
style.load styleFile
'Error Handaling
if (source.parseError.errorCode <> 0) then
'result = reportParseError(source.parseError)
set oerr = source.parseError
sErrMsg = "XML Parsing Error. File: " & oErr.url & " Reason : " &
oErr.reason & " Line: " & oErr.line & ", Character: " & oErr.linepos & ",
Text: " & oErr.srcText
Response.Write sErrMsg
elseif (style.parseError.errorCode <> 0) then
'result = reportParseError(style.parseError)
set oerr = style.parseError
sErrMsg = "XML Parsing Error. File: " & oErr.url & " Reason : " &
oErr.reason & " Line: " & oErr.line & ", Character: " & oErr.linepos & ",
Text: " & oErr.srcText
Response.Write sErrMsg
else
source.transformNodeToObject style,Response
end if
End Function

'MY XSL FILE CODE
<?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" version="4.0" encoding="utf-8"/>
<xsl:variable name="name">??!</xsl:variable>
<xsl:template match="data">
<html>
<head><META http-equiv="Content-Type" content="text/html;
charset=utf-8"/></head>
<body>
<hr/>
Name from XML is : <xsl:value-of select="//name"/>
<hr/>
Variable/Contant Value from XSL is : <xsl:value-of select="$name"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Jul 19 '05 #1
0 1834

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Val Melamed | last post: by
19 posts views Thread by Mark Miller | last post: by
6 posts views Thread by Alfred Taylor | last post: by
11 posts views Thread by Lucky | last post: by
3 posts views Thread by Sharon | last post: by
13 posts views Thread by yawnmoth | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.