dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: View XML File via XMLDOM and XSLT

  1. #1
    Join Date
    Nov 2002
    Posts
    76

    View XML File via XMLDOM and XSLT

    I have an XML file which i transform using an XSL file. In ASP i use the following code to change a couple of variables in the XML file before transforming it with the XSL file (the variables determine which parts of the xml are displayed);

    "
    '--Select Parameters element and amend according to querystring info
    set objNode = objXML.getElementsByTagName("parameters")
    call objNode.item(0).setAttribute("id_view",intIDView)
    call objNode.item(0).setAttribute("columns",intColumns)

    '--Load XSL
    set objXSL = Server.CreateObject("Microsoft.XMLDOM")
    objXSL.async = false
    objXSL.load(Server.MapPath(strXSLFile))

    '--Transform file
    Response.Write(objXML.transformNode(objXSL))

    Set objXML = nothing
    Set objXSL = nothing
    Set objNode = nothing
    "

    The xml file looks like this;

    "
    <?xml version='1.0'?>

    <gallery>

    <!--Updated from view.asp page-->
    <parameters id_view="10" columns="1" id_image="dr0001"/>

    ......all the other elements
    </gallery>
    "

    It works fine but I am not sure this is the best way to achieve my aim (which is to have an xml file which has the content details formatted by the XSL based on variables set on obtained from an .asp page).

    Any advice would be gratefully accepted.

    Yours

    Wastlinger

  2. #2
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    2,653
    There is nothing wrong wit h your XML part of the code for setting up an attribute.And yes to change the attributes thats the way to do it.

    Khalid

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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



Recent Articles