Forum Moderators: open

Message Too Old, No Replies

Blank page when using XSL style sheet on SelectSingleNode

Blank page when using XSL style sheet on SelectSingleNode

         

Cass101

12:14 pm on Apr 29, 2005 (gmt 0)

10+ Year Member



I am using the following ASP to select a single record from an XML file, based on the query string, and try to apply an XSL style sheet to it. The problem I'm having is it is appearing blank, without the stylesheet. The values are being collected, as they display when converted to text, just not when using the stylesheet.

<% @ LANGUAGE = "VBScript" %>

<%
Option Explicit
response.Expires = 0

'Declare variable names'
Dim XML_Object, XSL_Object, query, NODE_Object, NodeText

Set XML_Object = Server.CreateObject("Microsoft.XMLDOM")
XML_Object.async = false
XML_Object.load(Server.MapPath("events.xml"))
XML_Object.setProperty "SelectionLanguage", "XPath"

'Request the ProductID value from the query string in the URL'
query = Request.QueryString("ProductID")

Set NODE_Object = XML_Object.SelectSingleNode("events/workshop[@id='" & query & "']")
NodeText = NODE_Object.Text

Set XSL_Object = Server.CreateObject("Microsoft.XMLDOM")
XSL_Object.async = false
XSL_Object.load(Server.MapPath("transform.xsl"))

Response.Write(NODE_Object.transformNode(XSL_Object))
Response.Write("<BR>" & NodeText & "<BR>" & query)

Set XML_Object = Nothing
Set XSL_Object = Nothing
Set NODE_Object = Nothing

%>

Does anybody have any ideas why this is happening?
If I apply the XSL to the complete XML file it is fine, but only when I try to get the single entry does it not work.

Please Help. Thanks in advance.

coffeebean

3:44 am on Apr 30, 2005 (gmt 0)

10+ Year Member



It would help to see sample xsl. Does it have a template that matches workshop elements?

Cass101

2:00 pm on Apr 30, 2005 (gmt 0)

10+ Year Member



Hi, thanks for the reply.

The XSL sheet does match all the workshop elements, which is why it was so confusing as to why it wouldn't work.

I have, however, resolved the problem of displaying a single XML record by abandoning the SelectSingleNode method, and instead passing the queryString to the XSL as a parameter and doing the filtering in XSL. This method is also allowing me more freedom in what I do with the pages as well.

Thanks again for the reply.

macrost

11:27 am on May 1, 2005 (gmt 0)

10+ Year Member



Instead of events/workshop[@id= try events/workshop/@id=