<% Option Explicit %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Categories listing</title>
</head>
<body>
<!-- #include file=AjaxLibrary.asp -->
<%
Dim CatID : CatID = Request("category")
Dim CatRS : Set CatRS = DB.Execute("Select * From Categories Where CategoryId = '" & CatID & "'")
Dim QueRS : Set QueRS = DB.Execute("Select * From QA Where Category = '" & CatID & "'")
Dim QList : Set QList = NewXMLObject("Category")
Dim QNode,XSL
If CatRS.EOF Then PrintError "Unknown category: " & CatID
With QList.documentElement
.setAttribute "id",CatRS("CategoryId").Value
.setAttribute "name",CatRS("CategoryName").Value
End With
While Not QueRS.EOF
Set QNode = NewXMLElement(QList,"Question",Null)
QNode.setAttribute "id",QueRS("QuestionId").Value
InsertHTMLFragment QNode,QueRS("Question").Value
QueRS.MoveNext
WEnd
XSL = "questions.xsl"
If Request("mode") = "ajax" Then XSL = Null
OutputXMLResponse QList,XSL
%>
</body>
</html>