Please excuse me if this is not the correct forum for this question.

"How do I code HTML to use XML data in a web link?"

I want to use XML data to easily change server names for links on 15+ web sites with 100+ pages. Normally, a link would look like this:

"<a href='http://server1.someplace.com/..."

I want to place XML data in place of the server name. I've built an XML file with an element called "servername" and set it to "server1.someplace.com".

How do I get this to work? All help is greatly appreciated.

BTW: I'm using Dreamweaver CS3.

Bill

Recommended Answers

All 2 Replies

You can't code anything in HTML but if you are using a server-side language like PHP, ASP, etc. they all have functionality to parse XML files though I've only dealt with PHP XML parsing

You can use JavaScript like in this example, but I personaly consider to be too complicated for beginners. Simple way around can be to transfer your html documents to xsl documents. Then your dynamic linking can be simple like this

<p class="link" style="cursor: pointer;"> 
        <xsl:attribute name="onClick">show('<xsl:value-of select="servername"/>');
        </xsl:attribute>
         <xsl:value-of select='servername'/>
</p>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.