xsl document function with xml returned from asp


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: xsl document function with xml returned from asp

  1. #1
    Andrew \(BTClick\) Guest

    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...



  2. #2
    Andrew \(BTClick\) Guest

    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.devx.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...
    >
    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center