Democratic Underground Latest Greatest Lobby Journals Search Options Help Login
Google

Attention geeks: need help on ASP 3.0 and XML

Printer-friendly format Printer-friendly format
Printer-friendly format Email this thread to a friend
Printer-friendly format Bookmark this thread
This topic is archived.
Home » Discuss » The DU Lounge Donate to DU
 
no name no slogan Donating Member (1000+ posts) Send PM | Profile | Ignore Mon Nov-24-03 11:55 AM
Original message
Attention geeks: need help on ASP 3.0 and XML
Hi everyone, I could really use some help (or directions to good resources) on displaying XML via Active Server Pages (3.0, the "old-fashioned" version).

I'm redoing the navigation on a large website (80 static & 50 dynamic pages), and am hoping to use a combination of ASP and XML to render the elements.

I have one XML file which holds all the attribute information for each link (url, caption, type, etc.) and another file that will hold the order/structure of the links-- basically a site map.

I'm going to transform the XML on the server-side because I know that not all of the site's visitors are using the same platform, so I figured it would be easier to do it this way.

Is it possible for ASP to read through the second XML file (site map file) and attach the attributes to each link from the first XML file? Or do you have any online/offline resources which have come in handy for something like this?

I hope this makes sense to ANYONE out there. I'd like to get it done this week if possible, but I can wait, too. :D
Printer Friendly | Permalink |  | Top
Kamika Donating Member (1000+ posts) Send PM | Profile | Ignore Mon Nov-24-03 11:55 AM
Response to Original message
1. I'm a geek
I don't have a clue what the heck you're talking about though. Sorry
Printer Friendly | Permalink |  | Top
 
Radical__Moderate Donating Member (55 posts) Send PM | Profile | Ignore Mon Nov-24-03 12:08 PM
Response to Original message
2. Yes it quite simple with XSLT
Edited on Mon Nov-24-03 12:12 PM by Radical__Moderate
Let say we have one XML file called links.xml of the form

<links>
<link id="1">
<title>link1</title>
<href>page1.html</href>
</link>
<!-- more Links -->
</links>


in the XSLT file define a template such as

<template match="sitemap">
<table>
<for-each select="document('links.xml')/links"/>
<tr>
<td>
<a>
<attribute name="href">
<value-of value-of select="href"/>
<attribute>
<value-of select="title"/>
</a>
</td>
</tr>
<for-each>
</table>
<template>

The trick is using the XSLT function 'document()' in the for-each.

I hope this helps

Also if you down load the product XMLSPY from www.altova.com they include an example web site in their examples that does Exactly what you need



Printer Friendly | Permalink |  | Top
 
no name no slogan Donating Member (1000+ posts) Send PM | Profile | Ignore Mon Nov-24-03 12:15 PM
Response to Reply #2
3. This helps-- thanks!
I'll give this a shot it looks like exactly what I need!

Will this also work for non-MS browsers, like the Gecko-based ones? I assue it will work with all "modern" browswers that support the latest standards (i.e., post-4.x of Netscape/IE, CSS compliance, etc.)? I assume it will because it's just churning out valid HTML.

Thanks for the tip :D



Printer Friendly | Permalink |  | Top
 
Radical__Moderate Donating Member (55 posts) Send PM | Profile | Ignore Mon Nov-24-03 12:23 PM
Response to Reply #3
4. If you do the transform server side
You will not need to worry.

I have only found IE to be able to transform w3c compliant XSL to standards so you better do this on the server if you expect anybody to be using another user agent.

The asp code for doing and xslt transform in asp Javascript is

var xDoc=Server.CreateObject('Microsoft.XMLDOM');
var xXSL=Server.CreateObject('Microsoft.XMLDOM');
xDoc.async=false;
xXSL.async=false;
xDoc.load(Server.MapPath('the_xml_file.xml'));
xXSL.load(Server.MapPath('the_xsl_file.xsl'));
Response.Write(xDoc.documentElement.transformNode(xXSL.documentElement));
Printer Friendly | Permalink |  | Top
 
DU AdBot (1000+ posts) Click to send private message to this author Click to view 
this author's profile Click to add 
this author to your buddy list Click to add 
this author to your Ignore list Wed Apr 17th 2024, 09:06 PM
Response to Original message
Advertisements [?]
 Top

Home » Discuss » The DU Lounge Donate to DU

Powered by DCForum+ Version 1.1 Copyright 1997-2002 DCScripts.com
Software has been extensively modified by the DU administrators


Important Notices: By participating on this discussion board, visitors agree to abide by the rules outlined on our Rules page. Messages posted on the Democratic Underground Discussion Forums are the opinions of the individuals who post them, and do not necessarily represent the opinions of Democratic Underground, LLC.

Home  |  Discussion Forums  |  Journals |  Store  |  Donate

About DU  |  Contact Us  |  Privacy Policy

Got a message for Democratic Underground? Click here to send us a message.

© 2001 - 2011 Democratic Underground, LLC