Click to See Complete Forum and Search --> : creating a URL from multiple XML fields


barracuda
02-07-2003, 09:13 AM
Hi, I'm new to XML so go easy...

:confused:

I am loading an XML document to be displayed as a table in HTML. I want to create a hyperlink from two or more of the XML fields. I can do it with one or the other, but can't work out how to join them. I think it is possible in javascript, but can't work out how to do it.

The XML is structured like this:

<Airfares>
<LINKPREFIX>http://linkprefix.com?a=1&b=2&url=</LINKPREFIX>
<LINKSUFFIX>&id=567</LINKSUFFIX>
<OFFER>
<PRICE>£160</PRICE>
<URL>http://www.destination-url.com</URL>
</OFFER>
</Airfares>

The composite URL from these fields would be:

http://linkprefix.com?a=1&b=2&url=http://www.destination-url.com&id=567


The HTML I am using is:

<xml id="datafeed" src="http://www.xyz.com/flights.xml"
async="false"></xml>
<table border="0" datasrc="#datafeed" datafld="OFFER" cellpadding="1" id=flightoffers>
<tr>
<td align=right><a datafld="LINKPREFIX" datasrc="#datafeed">
<span datafld="PRICE"></span></a></font>
</td>

</tr>
</table>

What do I need to do?

Charles
02-07-2003, 09:22 AM
It's not clear just what it is that you are tying to do. How are you transforming the XML into HTML? Are you using XSLT? Perl?

barracuda
02-07-2003, 09:41 AM
The XML file is loaded into the HTML using the <xml> tag:

<xml id="datafeed" src="http://www.xyz.com/flights.xml"
async="false"></xml>

and then bound to the table:

<table border="0" datasrc="#datafeed" datafld="OFFER" cellpadding="1" id=flightoffers>

I hope this clarifies.

Charles
02-07-2003, 09:56 AM
There is no XML tag in HTML. There's not much help that I can give you, I'm afraid.

barracuda
02-07-2003, 09:58 AM
Maybe not standard HTML, but IE5 supports the XML tag - that bit isn't the problem, it works.

See the following for more info:

http://www.w3schools.com/xml/xml_data_island.asp

Stefan
02-07-2003, 11:15 AM
Originally posted by barracuda
Maybe not standard HTML, but IE5 supports the XML tag - that bit isn't the problem, it works.

See the following for more info:

http://www.w3schools.com/xml/xml_data_island.asp

Somethimes I'm amazed at the crap posted at w3c schools.

I wonder who writes and proof-reads what gets on there.

If you want to include XML in your documents, do it the proper way and use eg XHTML, HTML.

barracuda
02-07-2003, 11:21 AM
Thanks for all your help guys.

Why are you all so negative? I've just started, but receive nothing but BS.

This seems to be a forum to avoid in future. Bye.

mervinoh
04-10-2003, 05:29 PM
How should I include a XML file in XHTML?
I have an external XML file, and I want to read data from it.
I want it ot be browser and platform independent - no Microsoft IE specific stuff.

Thanks for your help.

khalidali63
04-10-2003, 06:41 PM
The only way you can do this is by using XML and XSL/XSLT.

what you'd need to do is appy xsl to your xml file and thenopen this xml file in the browser(NS6+ and IE6+)

Cheers

Khalid