?
Solved

Vbscript not displaying links

Posted on 2011-02-16
11
Medium Priority
?
850 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

762 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