Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

xsl document function with xml returned from asp

if anyone could help with this problem, it would be greatly appreciated...

basically i have the following flow on a site i am working on

client --> asp page --> transform xml document (file) with xsl template
(file) --> return html to client

the problem i am having is i have a document() function in my xslt, that i
want to point to
an asp page that retrieves data and returns valid xml, but i get the
following error:

Msxml3.dll error '80004005'
Error while parsing "http://localhost/test/app/obj/DKMenu1.asp". No data is
available for the requested resource.
/test/include/transform.inc.asp, line 121

The error occurs when executing the transform on the template processor.

The xslt i am using looks like this:
<xsl:template match="dkcontrol">
<xsl:variable name="c-xml" select="document(@xml)"/>
<xsl:apply-templates select="$c-xml/control">
<xsl:with-param name="ControlID" select="@id"/>
</xsl:apply-templates>
</xsl:template>

the node it is operating against is defined as follows:

<dkcontrol id="MenuControl1" type="DKMenu"
xml="http://localhost/test/app/obj/DKMenu1.asp"/>
</div>

and DKMenu1.asp does the following:

<!--#include file="../../include/transform.inc.asp"-->
<%
Response.ContentType = "text/xml"
Set oDoc = GetXMLDocument("DKMenu1.xml")
Response.Write oDoc.xml
%>

(Note: GetXMLDocument is just a standard function I use to retreive an xml
document on disk into
an XMLDocument object

is it valid to reference a url like this in the xslt document() function?
from what i have read it is. When i run the asp page directly, i get a valid
xml document returned into my browser.

Thanks...
[1895 byte] By [Andrew \-BTClick\] at [2007-11-9 15:27:17]
# 1 Re: xsl document function with xml returned from asp
panic over... i figured it out, thanks to this thread on wrox:
http://p2p.wrox.com/archive/xslt/2001-10/29.asp

it seems you need to use the server safe option on your xmldocument objects
in order to load
xml from urls in your stylesheets: e.g.

set oXml = Server.CreateObject("MSXML2.FreeThreadedDOMDocument.3.0")
oXml.setProperty "ServerHTTPRequest",true
oXml.async = False

"Andrew (BTClick)" <andrew.johnston@devknowledge.com> wrote in message
news:3dcc36f0$1@tnews.web.dev-archive.com...
> if anyone could help with this problem, it would be greatly appreciated...
>
> basically i have the following flow on a site i am working on
>
> client --> asp page --> transform xml document (file) with xsl template
> (file) --> return html to client
>
> the problem i am having is i have a document() function in my xslt, that i
> want to point to
> an asp page that retrieves data and returns valid xml, but i get the
> following error:
>
> Msxml3.dll error '80004005'
> Error while parsing "http://localhost/test/app/obj/DKMenu1.asp". No data
is
> available for the requested resource.
> /test/include/transform.inc.asp, line 121
>
> The error occurs when executing the transform on the template processor.
>
> The xslt i am using looks like this:
> <xsl:template match="dkcontrol">
> <xsl:variable name="c-xml" select="document(@xml)"/>
> <xsl:apply-templates select="$c-xml/control">
> <xsl:with-param name="ControlID" select="@id"/>
> </xsl:apply-templates>
> </xsl:template>
>
> the node it is operating against is defined as follows:
>
> <dkcontrol id="MenuControl1" type="DKMenu"
> xml="http://localhost/test/app/obj/DKMenu1.asp"/>
> </div>
>
> and DKMenu1.asp does the following:
>
> <!--#include file="../../include/transform.inc.asp"-->
> <%
> Response.ContentType = "text/xml"
> Set oDoc = GetXMLDocument("DKMenu1.xml")
> Response.Write oDoc.xml
> %>
>
> (Note: GetXMLDocument is just a standard function I use to retreive an xml
> document on disk into
> an XMLDocument object
>
> is it valid to reference a url like this in the xslt document() function?
> from what i have read it is. When i run the asp page directly, i get a
valid
> xml document returned into my browser.
>
> Thanks...
>
>
Andrew \-BTClick\ at 2007-11-11 23:29:52 >