%@ language = "VBScript" %>
<% option explicit %>
My Books
<% writeBooks %>
<%
sub writeBooks
dim xmlDocument
dim xPath
dim book
dim books
dim bookTitle
dim bookAuthor
dim bookDescriptionNode
dim bookDescription
dim xhtml
xhtml = ""
set xmlDocument = getXml("books.xml")
xPath = "//book"
set books = xmlDocument.selectNodes(xPath)
for each book in books
bookTitle = book.selectSingleNode("title").text
bookAuthor = book.selectSingleNode("author").text
set bookDescriptionNode = _
book.selectSingleNode("description")
if bookDescriptionNode is nothing then
bookDescription = "(No description available)"
else
bookDescription = bookDescriptionNode.text
end if
xhtml = xhtml & "" & _
bookTitle & "
" & _
"" & bookAuthor & "
"
xhtml = xhtml & "" & bookDescription & "
"
next
response.write xhtml
end sub
%>