This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
ASP/XML/XSL Combo
- To: xsl-list at lists dot mulberrytech dot com
- Subject: [xsl] ASP/XML/XSL Combo
- From: "Robert Dahnke" <robert dot dahnke at mail dot com>
- Date: Sat, 09 Jun 2001 07:03:53 +0800
- Reply-To: xsl-list at lists dot mulberrytech dot com
I need to search an XML document for text with ASP (Serverside) and I was wondering what was wrong with this code.
The structure of the XML document is...
<polls>
<poll>
<question>Question Here</question>
</poll>
</polls>
<%
set dbDocument = Server.CreateObject("Microsoft.XMLDOM")
set style = Server.CreateObject("Microsoft.XMLDOM")
set resultSet = Server.CreateObject("Microsoft.XMLDOM")
dbDocument.async = false
style.async = false
dbDocument.load("xml/Polls.xml")
style.load("xsl/generic.xsl")
Set objRootElement = resultSet.createElement("polls")
resultSet.appendChild objRootElement
function DoSearch(searchStr)
set docRoot = dbDocument.documentElement
set polls = docRoot.selectNodes("/polls/poll")
for each i in polls
set poll = polls.item(i)
set question = poll.selectSingleNode("question")
if ( question.text.search(searchStr) ) Then
set cloneTree = poll.cloneNode(true)
objRootElement.appendChild cloneTree
end if
next
end function
call DoSearch("Expansion")
Response.Write objRootElement.transformNode(style)
--
_______________________________________________
Make PC-to-Phone calls with Net2Phone.
Sign-up today at: http://www.net2phone.com/cgi-bin/link.cgi?121
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list