Jump to content

Updating html content with xml..


bo0da
 Share

Recommended Posts

Hi.Were looking to speed up the process of updating the rates section of our website.At the moment I have to do it manually, cutting and pasting code between excel and dreamweaver and it takes all day. We can get our data in xml format, and i was wondering how easy it is to achieve the same look as what we get now.This is how we want it to look..http://www.cheersinternational.com/africaconnect.htmThe drop down menu is the only info that will change.This is a bit of the code from the drop down..

<option value="######">Choose destination</option><option value="#13 mins##13 mins">Afghanistan</option><option value="#13 mins##13 mins">Afghanistan  Mobile</option>

And this link is to an xml sheet we made for someone else to use.http://www.talkntalk.co.uk/talkntalktates.xmlIs it possible to make the above look like the drop down menu in the first link?Thanks in advance.-Andy

Link to comment
Share on other sites

You may create an XSLT stylesheet to transform the XML into a menu (execuse my disdesire to show you how would it look) and use this code to place it properly.

Link to comment
Share on other sites

Yes. Review this section of the w3school's XML tutorial:http://www.w3schools.com/xml/xml_data_island.aspGiven the fact that you are just trying this for a small section of content, it should not be hard to work out using this method.As your requirements expand and get more complicated, you will find folks suggesting using XSL to transform your XML into HTML:http://www.w3schools.com/xsl/xsl_transformation.aspThen, as your code or content becomes even more complex and even database driven, you would then escalate the coding environment to include a server side scripting language like asp, php, or cold fusion where you would perform the transformation, like this (for example):http://w3schools.invisionzone.com/index.ph...indpost&p=16422Hope this helps.

Link to comment
Share on other sites

Noooo. Data Islands are only supported in IE. It may seem as the easiest method, but it's the worst. They are what I like to call "web mistakes", simillarly to the <font> tag. It seems convinient at first (direct XML to XHTML binding) but then you realize it's drawbacks, such as the lack of conditionals, advanced XPath expresions, etc.As for server side scripting... if you have ASP or Cold Fusion, you may use it to execute the XSLT. This would make the transition between the above method and the new one a lot easier. If php, you would use PHP's XML functions + other PHP functions (in short: a lot of code) for the same purpose that XSLT has and use includes at the proper place. Using XML and XSLT and execute them with a server side scripting language is the best method in my opinion, but please, don't even get started with Data Islands.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...