[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Vbscript not displaying links

Posted on 2011-02-16
11
Medium Priority
?
859 Views
Last Modified: 2012-08-13
Hi!

The below listed vbscript on an ASP page is not giving me any errors, but it also is not displaying the links from our XML page using the XSL page to render it. Any specific code corrections would be greatly appreciated.

<%
      Dim NewXML, re, oXmlSrc, oXml, oNode, oXslSrc, oXsl, oXslTemplate
     
      ' If you're using an XSLTemplate and XSLProcessor object,
      '   you have to use the FreeThreaded versions of DOMDocument
      Set oXmlSrc = Server.CreateObject("MSXML2.FreeThreadedDOMDocument.4.0")
      Call oXmlSrc.setProperty("ServerHTTPRequest", True)            
      oXmlSrc.async = False
     
      Set oXslSrc = Server.CreateObject("MSXML2.FreeThreadedDOMDocument.4.0")
      Call oXslSrc.setProperty("ServerHTTPRequest", True)            
      oXslSrc.async = False
     
      Set oXslTemplate = Server.CreateObject("MSXML2.XSLTemplate.4.0")

      ' If I haven't posted the form first, then load my unaltered XML.
      ' If I'm posting info to resort or edit, then build my XML from that.
     
    ' On Error Resume Next  'debugging code if table does not appear uncomment this line

      'xmlResponse = Replace(xmlResponse, "<?xml version=""1.0""?>", "<?xml version=""1.0"" encoding=""utf-8""?>")

            'Call oXmlSrc.loadXML (xmlResponse)      
            Call oXmlSrc.load (Server.MapPath("sitemap.xml"))
          'Response.Write "<xmp>" & oXmlSrc.xml & "</xmp>"    'debugging code
          'newXML = oXmlSrc.xml
        'Set re = new regexp
        're.pattern = " xmlns.+?>"
        'newXML = re.replace(newXML,">")
        'Call oXmlSrc.loadXML(newXML)
  if oXslsrc.load (Server.MapPath("sitemap.xsl")) then
     Set oXslTemplate.stylesheet = oXslsrc
     Set oXslProcessor = oXslTemplate.createProcessor()
     oXslProcessor.input = oXmlsrc
     Response.Write oXmlsrc
    else
       Response.Write "Could Not Retrieve SiteMap.xsl stylesheet"
end if %>
0
Comment
Question by:TrueBlue
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
11 Comments
 
LVL 65

Expert Comment

by:RobSampson
ID: 34911778
It might be because you're loading the XML file twice.  Comment out this line:
            Call oXmlSrc.load (Server.MapPath("sitemap.xml"))

because this line
  If oXslsrc.load (Server.MapPath("sitemap.xsl")) Then

will also load it.

Also, do you get any output if you change this:
  If oXslsrc.load (Server.MapPath("sitemap.xsl")) Then

to this
  Response.Write "Loading xml...<BR>"
  If oXslsrc.load (Server.MapPath("sitemap.xsl")) Then
     Response.Write "XML loaded...<BR>"


Regards,

Rob.
0
 

Author Comment

by:TrueBlue
ID: 34912173
Rob,

I did as you suggested and it returned the following ...

Loading xml...
XML loaded...
Response object error 'ASP 0185 : 80020003'
Missing Default Property
/sitemap.asp, line 0
A default property was not found for the object.

Any ideas?
TIA
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 34912513
Should this line:
     Response.Write oXmlsrc

be this:
     Response.Write oXmlsrc.xml

It looks like the Response object error that you are getting is due to this:
     Response.Write oXmlsrc

and oXmlsrc is an object, so you can't output it, you need to reference one of its (string) properties.

Rob.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:TrueBlue
ID: 34912990
Rob,

That fixed the error.
Now it displays the following...
Loading xml...
XML loaded...

But, no links are displayed.
Any other ideas?

TIA
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 34913020
Does it display any xml from the sitemap.xml?

What is the format of your xml? We might need to read the xml nodes to be able to output them.

Rob.
0
 

Author Comment

by:TrueBlue
ID: 34920776
Rob,
The XML looks fine when I look at the page using IE.

Here is the XML:
http://www.topsecurityinc.com/sitemap.xml
Here is the XSL:
http://www.topsecurityinc.com/sitemap.xsl

Any suggestions would be appreciated.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 34921203
OK, I'll see if I can run some tests with it.  So do you want the entire xml to be output to the page?

Rob.
0
 

Author Comment

by:TrueBlue
ID: 34921448
Rob,

I am basically trying to make a people friendly sitemap using the XML file.

TIA
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 34922986
Hi, isn't it is possible to point your XML file to use the XSL directly, by adding something like this:
<?xml-stylesheet type="text/xsl" href="sitemap.xsl"?>

And then display the xml in the browser?

Regards,

Rob.
0
 

Author Comment

by:TrueBlue
ID: 34927487
Rob,

Wouldn't this method negate the ability of search engines being able to properly read the sitemap for indexing purposed?

TIA
0
 
LVL 65

Accepted Solution

by:
RobSampson earned 2000 total points
ID: 34931797
It would if you had it processed client side.  It looks like if you process it server side, then Google would index the processed page.

See if this gives you any more information:
http://msdn.microsoft.com/en-us/magazine/bb984985.aspx

Regards,

Rob.
0

Featured Post

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question