user1938007
user1938007

Reputation: 459

How to display external XML in an HTML file

I have an XML file styled with external XSL file, but when I specify the path to it in HTML body tag, it doesn't display the data, just a blank page. Is there something else that needs to be done?

Basically what I've done in html is this:

<html>
   <body>
      <xml id="asdfgh" src="asdfgh.xml"></xml>
   </body>
</html>

Upvotes: 1

Views: 4838

Answers (2)

HAL 9000
HAL 9000

Reputation: 3985

try using an good old iframe:

<iframe id="asdfgh" src="asdfgh.xml"></iframe>

Upvotes: 5

Edorka
Edorka

Reputation: 1811

xml tags are often ignored by browsers on HTML documents, in best cases they will only show the inner text. If you need to show the whole code you will need some XSLT to transform the XML into HTML or event a Javascript program that prints it. Maybe this one http://www.levmuchnik.net/Content/ProgrammingTips/WEB/XMLDisplay/DisplayXMLFileWithJavascript.html

Upvotes: 0

Related Questions