Hi,
I have to read a part of document & transoform into HTML using xsl. To read the document i am using selectsinglenode with XPATH & code runs fine.
+++++++++++++++++++++++++
Function viewDetail(strXMLFile, strXSLFile, strEMail)
Dim objXML
Dim objNode
Dim objXSL
set objXML = Server.CreateObject("Microsoft.XMLDOM")
objXML.async = false
objXML.load(strXMLFile)
'Get the XML record that you wish to view by calling the 'SelectSingleNode method and passing in the e-mail address of the 'contact. Set objNode = objXML.SelectSingleNode("rolodex/contact[field/field_value='" & strEMail & "']") set objXSL = Server.CreateObject("Microsoft.XMLDOM") objXSL.async = false objXSL.load(strXSLFile) Response.Write(objNode.transformNode(objXSL)) End Function +++++++++++++++++++++++++++
But problems occur when strEmail value brings wrong data which is not available in XML data file. In that case, it displays asp error. Is there any way to handle the error as objXML doesnt return anything? Please let me know if there is any.
thanks,
hungrymind
I have to read a part of document & transoform into HTML using xsl. To read the document i am using selectsinglenode with XPATH & code runs fine.
+++++++++++++++++++++++++
Function viewDetail(strXMLFile, strXSLFile, strEMail)
Dim objXML
Dim objNode
Dim objXSL
set objXML = Server.CreateObject("Microsoft.XMLDOM")
objXML.async = false
objXML.load(strXMLFile)
'Get the XML record that you wish to view by calling the 'SelectSingleNode method and passing in the e-mail address of the 'contact. Set objNode = objXML.SelectSingleNode("rolodex/contact[field/field_value='" & strEMail & "']") set objXSL = Server.CreateObject("Microsoft.XMLDOM") objXSL.async = false objXSL.load(strXSLFile) Response.Write(objNode.transformNode(objXSL)) End Function +++++++++++++++++++++++++++
But problems occur when strEmail value brings wrong data which is not available in XML data file. In that case, it displays asp error. Is there any way to handle the error as objXML doesnt return anything? Please let me know if there is any.
thanks,
hungrymind